/ Undifined / 3 - WAP to calculate the area and circumference of a circle

3 - WAP to calculate the area and circumference of a circle

WAP to calculate the area and circumference of a circle

#include <stdio.h>
int main()
{
int circle_radius;
float PI_VALUE=3.14, circle_area, circle_circumf;

//Ask user to enter the radius of circle
printf
("\nEnter radius of circle: ");
//Storing the user input into variable circle_radius
scanf
("%d",&circle_radius);

//Calculate and display Area
circle_area
= PI_VALUE * circle_radius * circle_radius;
printf
("\nArea of circle is: %f",circle_area);

//Caluclate and display Circumference
circle_circumf
= 2 * PI_VALUE * circle_radius;
printf
("\nCircumference of circle is: %f",circle_circumf);

return(0);
}

Output

Enter radius of circle: 2
Area of circle is: 12.560000
Circumference of circle is: 12.560000

about author

Blogger Sens it website about blogger templates and blogger widgets you can find us on social media
Previous Post :Go to tne previous Post
Next Post:Go to tne Next Post

No comments:

Post a Comment