Write a program to calculate the area of a circle and display the result. Use the formula: A=?r2 where Pi (?) is approximately e
Algorithm:
Input Enter the radius (r)
Process Compute the Area (A=Pi*r*r)
Output Display the Area (A)
Solution:
#include
#include
void main ( )
{
int r;
flaot A, Pi = 3.1416;
clrscr ( );
printf (“\n Enter the radius:”);
scanf (“%d”, &r);
A=Pi* r * r;
printf (“\n The area: %f”,A);
getch ( );
}
Comments
Post a Comment