C Program To Calculate Circumference of Circle


Given the radius of a Circle, write a C program to calculate circumference of the Circle.

Formula To Calculate Circumference of Circle

circumference = 2 * PI * radius;
Where PI is approximately equal to 3.14

Related Read:
Basic Arithmetic Operations In C

Expected Output for the Input

User Input:
Enter Radius of the Circle
5

Output:
Circumference of the Circle is 31.400002

Video Tutorial: C Program To Calculate Circumference of Circle



YouTube Link: https://www.youtube.com/watch?v=o2r2bDOuCX4 [Watch the Video In Full Screen.]

Source Code: C Program To Calculate Circumference of Circle

  1. #include<stdio.h>  
  2.   
  3. int main()  
  4. {  
  5.     const float PI = 3.14;  
  6.           float r, c;  
  7.   
  8.     printf("Enter Radius of the Circle\n");  
  9.     scanf("%f", &r);  
  10.   
  11.     c = 2 * PI * r;  
  12.   
  13.     printf("Circumference of the Circle is %f\n", c);  
  14.   
  15.     return 0;  
  16. }  

Output 1:
Enter Radius of the Circle
10
Circumference of the Circle is 62.800003

Output 2:
Enter Radius of the Circle
41
Circumference of the Circle is 257.480011

For list of all c programming interviews / viva question and answers visit: C Programming Interview / Viva Q&A List

For full C programming language free video tutorial list visit:C Programming: Beginner To Advance To Expert

Leave a Reply

Your email address will not be published. Required fields are marked *