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 https://www.youtube.com/watch?v=o2r2bDOuCX4]

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

Source Code: C Program To Calculate Circumference of Circle

#include<stdio.h>

int main()
{
    const float PI = 3.14;
          float r, c;

    printf("Enter Radius of the Circle\n");
    scanf("%f", &r);

    c = 2 * PI * r;

    printf("Circumference of the Circle is %f\n", c);

    return 0;
}

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 *