Question: Hello, I would like for some help if possible could you write the code out and keep in mind that I would be submitting this

Hello, I would like for some help if possible could you write the code out and keep in mind that I would be submitting this through mimir, this is for my intro to c programming so I would like that. I put this code in but received an error.

Hello, I would like for some help if possible could you writethe code out and keep in mind that I would be submittingthis through mimir, this is for my intro to c programming so

Problem: Random Range Checker Write a program that takes the coordinates la b) of the center of a circle and its radius r as input Then generate a random point with x - a random int from 1 to 2-2-3 andy - a random int from 1 to b-r-3. Then your program should determine whether the random point lies inside the circle on the circle or outside of the circle [Additional requirements: You have to use the rand() srand() sqrt( )and powl ) functions) The following figures will give you some more ideas about the solution. (a, b). Oxy (x,y) Calculating distance between two points: (...) d = x - x) + (- y) . (X,Y) Sample Input/output 1 [need to be tested manually]: Enter Center xy coordinate and radius 00 10 The generated coordinate is: (3.a) Point is inside circle Sample Input/output2 (need to be tested manually! Enter Center xy coordinate and radius 00 10 The generated coordinate is: [3.13] Point is outside the circle Sample Input/output3 (need to be tested manually! Enter Center xy coordinate and radius 10 The generated coordinate is: (6.8] Point is on the circle 10 X = 16 1 #include 2 #include 3 #include 4 5 - int main(){ 6 Il read a, bof center 7 int a,b,r; 8 Il read 9 printf("Enter Center X Y coordinate and radius "); scanf("%d %d %d",&a,&b,&r); 11 12 int x,y; 13 14 // generate x and y 15 (rand()%(a+r-3))+1; y = (rand()%(b+r-3))+1; 17 18 // print x and y 19 printf("The generated coordinate is[%d%d] ",x,y); 20 21 // check distance 22 double al, a2; 23 al = x; 24 a2 25 26 // find distance 27 double distance = sqrt((pow( (al-a),2)+pow( (al-a),2))); 28 29 Il compare radius and dist 30 if(distance > r){ 31 printf("Point is outside the circle "); 32 } 33 34 else if(distance == n){ 35 printf("Point is on the circle "); } 37 38 else if(distance

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!