Key Features

Experienced Teachers
Smart Classes
Regular Test
Study Material

Well qualified teachers with industrial experience.

To visualise or understand topics very easly.

We are organizing online and offline regular test.

We are providing prescribed study material.

Friday, October 30, 2020

Question : Write a C Program to find area and circumference of circle.

 

Question : Write a C Program to find area and circumference of circle.

/*
Write a C Program to find area and circumference of circle.
Formula:
Area = 3.14 * radius * radius
Circumference = 2 * 3.14 * radius
Program
*/

#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



Thank you very much for reading carefully, if you have any other questions, you can share it with us through comments, if this information was important to you, please let us know through comments.

Please do comment and share.
Thank You.

No comments:

Post a Comment