Finding the area and circumference of a circle in C programming

CWC
2 Min Read

The concept of circularity is often used to describe something like a closed-loop, or a closed system. For example, a bicycle wheel has a circular path, meaning that the rider can’t change direction without the wheel. The concept of circularity is very useful in describing a range of problems, including the problem of determining the center of a circle, or finding its radius. In a programming context, it’s often used to describe loops such as a while loop or an if statement. For example, when using a while loop, the loop will repeat until some condition is met. Once the condition is met, the while loop exits. In programming, we would say that the while loop is “circular” since it loops over and over again until the condition is met.

In the C programming language, there are two ways to find the area of a circle: using the formula A=πr² or calculating the length of a circle using the Pythagorean theorem. Both methods are accurate, but there is another method that is faster, easier, and more accurate.

The distance around a circle is called its circumference. The distance across a circle through its center is called its diameter. In this program we are calculating the area and circumference of the circle in C programming.

#include<stdio.h>
#include<conio.h>
#define PI 3.14
main()
{   int radius;
float area,circumference;  
clrscr();
printf("\nEnter the radius of the circle : "); 
scanf("%d",&radius);
area = PI * radius * radius;  
circum = 2 * PI * radius;
printf("\nThe area of the circle is %.2f",area);
printf("\nThe circumference of the circle is %.2f",circumference);
getch();  
return 0;
}

We have used two formulas for finding area and circumference of circle.

area = PI * radius * radius;
circum = 2 * PI * radius;

 

Share This Article
Leave a comment

Leave a Reply

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

English
Exit mobile version