Let’s take a look at how to calculate the circumference of the circle in C Programming. We are referring to an awesome book called “Let Us C” by “Yashwant Kanetkar“.  Hence, please come back to our portal regularly so that you don’t miss anything. If you have any problems with the program or need any assistance, don’t hesitate to write to us. We try to answer as quickly as possible.

Question:

Accept the values of radius of the circle and write a program to calculate the circumference.

Solution to calculate the circumference of circle in C:

Calculating the circumference of a circle in C is super easy. All you need to know is the formula and just like any other math program you can calculate the circumference. Here’s the algorithm:

  1. Input the radius of the circle from the user.
  2. Calculate the circumference using the formula – 2*pi*r
  3. Output the circle’s circumference

Here, we first initialise all the variables and set the value of pi to 3.14. Make sure that all the values are of the floating datatype or you won’t get accurate results. Then, ask the user to input the radius of the circle. Then use the math operators to calculate the result and display the output back to the user.

Download the source code:

Download Program

Program to calculate the circumference of the circle in C:

//C Program to calculate the circumference of a circle
#include<stdio.h>
#include<conio.h>
void main()
{
float pi = 3.14, circumference;
float radius;
clrscr();
printf("Enter the radius of the circle -  ") ;
scanf("%d",&radius);
circumference = 2*pi*radius;
printf("The circumference of the circle is %f ",circumference);
getch();
}

Output

Enter the radius of the circle: 30

The circumference of the circle is 188.5

Download the source code:

Please don’t forget to subscribe to us before you hit the download button! It helps us grow and provide more content.

Download Program

Read Also:

Introduction to C Programming

Check if the number is Odd or Even in C

Calculate the volume of a Cylinder in C

Print Even Numbers in C Programming

C Program to calculate the sum of digits

Harsh Shah

Harsh Shah

A highly motivated individual with a hunger to learn and share as much as I can about everything. Masters in Interaction Design with a Bachelors in Computer Science. I have worked with clients across the globe on various design and tech projects. I believe in giving back and that's how ReadMeNow was founded.

Leave a Reply