 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C Program for Program to find the area of a circle?
The area is a quantity that represents the extent of the figure in two dimensions. The area of a circle is the area covered by the circle in a two dimensional plane.
To find the area of a circle, the radius[r] or diameter[d](2* radius) is required.
The formula used to calculate the area is (π*r2) or {(π*d2)/4}.
Example Code
To find the area of a circle using radius.
#include <stdio.h> int main(void) {    float pie = 3.14;    int radius = 6;    printf("The radius of the circle is %d 
" , radius);    float area = (float)(pie* radius * radius);    printf("The area of the given circle is %f", area);    return 0; }  Output
The radius of the circle is 6 The area of the given circle is 113.040001
Example Code
To find the area of a circle using radius using math.h library. It uses the pow function of the math class to find the square of the given number.
#include <stdio.h> int main(void) {    float pie = 3.14;    int radius = 6;    printf("The radius of the circle is %d 
" , radius);    float area = (float)(pie* (pow(radius,2)));    printf("The area of the given circle is %f", area);    return 0; }  Output
The radius of the circle is 6 The area of the given circle is 113.040001
Example Code
To find the area of a circle using Diameter.
#include <stdio.h> int main(void) {    float pie = 3.14;    int Diameter = 12;    printf("The Diameter of the circle is %d 
" , Diameter);    float area = (float)((pie* Diameter * Diameter)/4);    printf("The area of the given circle is %f", area);    return 0; }  Output
The Diameter of the circle is 12 The area of the given circle is 113.040001
Advertisements
 