Tuesday, November 25, 2014

Area of the circle

Area of the circle

 

#include<stdio.h>
#include<math.h>
main()
{
    float a,b,x,y,dist,rad,area;
    printf("\nEnter first point a,b = \n");
    scanf("%f %f",&a,&b);
    printf("\n\nEnter another point x,y = \n");
    scanf("%f %f",&x,&y);
    dist = sqrt((a-x)*(a-x)+(b-y)*(b-y));
    rad = dist/2;
    area = 3.1416*rad*rad;
    if(dist>1)
    printf("\n\nArea of the circle is = %f\n",area);
    else
        printf("no circle!!! how i can compute the area");
    return 0;
}

No comments:

Post a Comment