Create a flow chart and a program to determine if a point, P(xx), lies WITHIN, O
ID: 3736342 • Letter: C
Question
Create a flow chart and a program to determine if a point, P(xx), lies WITHIN, ON, or OUTSIDE a circle of radius 5 1. Recall, the equation of a circle centered at the origin of a Cartesian coordinate system is x2 + y2 Specifically A. Prompt the user to "Enter 1 to run the program or 2 to Quit', after a description of the program B. If1 a. Prompt the user to 'Enter the xvalue, X, Defined as Word b. Prompt the user to Enter the yxalue, Y Defined as Word c. Compute x squared -xvaluex.value, Defined as Woro d. Compute y..s.quared -yvaluey value, Defined as Word e. Compute BadiusSauared -xsauared+ y.sauared, Define as Word f. Determine if Radius Sauared is less than 25 g. Determine If Radiu Squared is equal to 25 h. Determine If Readius Squared is greater than 25 i. Display if point lies within, on, or outside of circle Loop to A C. If 2 a. Quit Note 1: PBASIC only allows for integer values for x and y Note 2: Use SDEC for X and Y, because each could be negative Note 3: Compute C, D, and E separately, otherwise there will be an overflow Note 4: Show output results for each caseExplanation / Answer
#include<stdio.h>
#include<conio.h>
main()
{
int x,y,r,a,b,c;
clrscr();
printf("enter the value of circle's center");
scanf(" %d nbsp %d",&x, &y);
printf("enter the value of circle's radius");
scanf(" %d",&r);
printf("enter the value of point's coordinates");
scanf(" %d nbsp %d",&a, &b);
c= (sqrt((a-x)*(a-x) + (b-y)*(b-y)));
if (c>r)
{printf(" point lies outside the circle");}
else if(c<r)
{printf(" point lies inside the circle");}
else
{printf(" point lies on the circle");}
}
return 0;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.