area of circle,area of a circle c program,circumference of circle,write a program to find the area of circumference,program c find area and circumference of circle,area and circumference of circles,program to find area and circumference of a circle,area and circumference of circle,circumference of circle in c program,area and circumference of a circle in c program,circumference,c program to find circumference of circle
To calculate the diameter, circumference and area of circle in C language. We required some knowledge about circle. In our program we takes the value of radius as input.

Example
INPUT

Enter radius value
5


OUTPUT

Diameter of circle = 10
Circumference of circle = 31.4
Area of circle = 78.5

Knowledge Required

Diameter of Circle = 2 x radius of circle 

circumference of Circle = 2 x 3.14 x radius of circle.

Area of circle = 3.14 x (radius of circle)2

As shown below:

D = 2 r

C  = 2
Ï€
r
A
=
Ï€
r
2

 where,

D = Diameter of circle

C = Circumference of circle

A = Area of circle

r = radius of circle

pi(Ï€) = 3.142., which is constant

Logic to Solve Problem:

1. Take the radius in the form of input from user says in radius variable

2. Apply the above formulae and keep the result in required variable.

3. Finally, prints the resultant values of diameter, circumference and area of the circle in the respective variables.

Full Code to Calculate the diameter, circumference and area of circle.

/* 
Program to find out the diameter, circumference and area of a circle of given
radius  
 */  
   
 #include<stdio.h>  
   
 int main()  
 {  
   float Radius, DiameterOfCircle, CircumferenceOfCircle, AreaOfCircle;  
   /*  
   * Radius is for takes the value of radius in the form of input
  
   * DiameterOfCircle is for putting the value of diameter of circle  
   * CircumferenceOfCircle is for putting the value of circle 
   * AreaOfCircle is for putting the value of area of circle  
   */  
   printf("Enter the value of radius of circle\n");  
   scanf("%f",&Radius); // this takes the value of radius in the Radius variable  
   
   // Now calculate Diameter of circle  
    DiameterOfCircle = 2 * Radius;  
   
   // Now calculate the circumference of circle;
   CircumferenceOfCircle = 2 * 3.14 * Radius;  
   
   //Now calculate the area of circle  
   AreaOfCircle = 3.14 * Radius * Radius;  
   
   // Now print all the values  
    // Print Diameter Of Circle 
   printf("Diameter Of Circle = %.2f\n",DiameterOfCircle);
   // Print Circumference Of Circle 
   printf("Circumference Of Circle = %.2f\n",CircumferenceOfCircle); 
    // Print Area Of Circle  
   printf("Area Of Circle = %.2f",AreaOfCircle);
    return 0;  
 }  
   

\n is an escape sequence used to change the line in c language.

%f  is used as a format specifier because we need to enter float value as value of pi is 3.14. Thus, the resultant value of circumference and area of the circle could be of float value . Therefore, we use %f format specifier.

Output
Enter the value of radius of circle
5
Diameter Of Circle = 10.00
Circumference Of Circle = 31.40
Area Of Circle = 78.50







Please write this code on your own and Run this code and put the values of radius different and see the output of the diameter, circumference and  area of circle every time and comment your answer with input and output value.

As, everything is clear in the code, I hope you will be able to write a program how to find the diameter, circumference and area of rectangle in C language. If you have any query related to the above code or with this post. You are always welcome to post your query in the comment box!