Step 1: Begin
Step 2: Read radius
Step 3: area = 3.14 * radius * radius
Step 4: Print area
Step 5: End
Flowchart
Program
/*calculate the area of a cicle*/
#include
#include
void main()
{
float area,radius;
clrscr();
printf("enter radius of a circle");
scanf("%f",&radius);
area=3.14*radius*radius;
printf("Area of a circle is %f",area);
}
Illustration of the program:
Variables area is used for area of a circle and radius used for radius of a circle.
If you entered 6 as radius, area of a circle is 3.14 * 6 * 6 = 113.04
So, the output is
Area of a circle is 113.040000
No comments:
Post a Comment