please help... I dont know how to that
in this code I try to perform number of commands;
first getting tow points from the user.one represent the center of a circle and the other represent a point on the same circle.
then I must use 4 functions . and then to print on the screen these solutions:
r=radius d=diameter , c=circumference a= area. t
I have many bugs but I have no clue how to solve it , thanks for the helpers.
Code:
double distance(double x1, double x2, double y1, double y2)
{
double a=0 ,b=0 ,c=0, d=0 ,e=0 ;
a= x2 -x1;
b= y2 -y1;
c = a*a;
d = b*b;
e=c+d;
return sqrt(e);
}
double radius(double r_x1, double r_y1, double r_x2, double r_y2)
{
double r =0;
r = distance(r_x1, r_x2, r_y1, r_y2);
return r;
}
double circumference(double r)
{
double pai=3.1416, circ=0;
r = distance;
circ = rad * pai * 2;
return circ;
}
double area(double r)
{
double rad = distance, pai =3.1416, c=0;
r = rad*rad*pai;
return r;
}
int main()
{
double x1=0, x2=0, y1=0, y2=0, D=0;
printf("please enter tow points:\n");
scanf("%g %g %g %g", &x1, &y1, &x2,&y2);
D = distance(x1,x2,y1,y2) * 2;
printf("R = %g \n ",distance(x1,x2,y1,y2));
printf("D = %g \n" , 2* distance(x1,x2,y1,y2));
printf("C = %g \n ",circ(r));
printf("A = %g \n", area r));
return 0;
}