In this article, you will learn how to calculate the Area of a Circle using the C Programming Language. The program will prompt the user for the Radius and print out the area of the circle.
The circle’s area is determined by its Radius R. The formula to calculate the area is:
Area of a circle = \pi x R2
Where Pi is a constant of value 3.14.
#include <stdio.h> int main() { float radious, area; const float pi = 3.14; printf("Please enter the radius of circle: "); scanf("%f", & radious); area = pi * radious * radious; printf("The area of the circle is: %.2f", area); return 0; }
Output
Please enter the radius of circle: 5 The area of the circle is: 78.50
Happy coding!