Area of Circle using C language

Area of Circle:

Area of circle is equal to value of pi (3.1415) multiplied by the square of radius of circle.
So you need two variables of data type double, the variable are radius and area in case of using first formula and in case of second one , area and diameter are the variables of type double and pi is the constant value , you can define variable for it or not its up to you.
printf to display something to user and scanf to take something from user. "\n" is to go to next line. "\t " to give spaces. "stdio.h and conio.h " are the library files.

Program Code:

#include<stdio.h>
#include<conio.h>
int main()
{
printf("\t\t\t Area of Cirlce\n******************************************************\n");
    double r , area = 0;
    
printf("\n\nEnter radius of Circle =  ");
scanf("%lf",&r);
area = 3.1415 * r * r;
printf("\n\nArea of Circle  =   %lf ", area );
printf("\n\n******************************************************");
getch();
}

Output:


Output

No comments:

Post a Comment

Please disable your ad blocker to support this website.

Our website relies on revenue from ads to keep providing free content.