C Program to Find Circumference(perimeter) and Area of a Circle

  • Write a C program to find circumference and area of a circle.
  • WAP in C to find circumference and area of circle when radius is given.

Required Knowledge

To find the circumference and area of circle, we will first take radius of circle as input from user using scanf function and then calculate area and perimeter of circle using following formulae.

  • Circumference of Circle = 2 x PI x Radius
  • Area of Circle = PI X Radius X Radius

C program to find the circumference and area of circle

C Program to Find Circumference(perimeter) and Area of a Circle

/*
 * C program to find circumference(perimeter) and area of a circle 
 */ 
   
#include <stdio.h>  
#define PI 3.141
 
int main() {  
    float radius;  
    float circumference, area;  
       
    /* 
     * Take Radius of circle as input from user
     */ 
    printf("Enter Radius of Circle\n");  
    scanf("%f", &radius);  
   
    /* 
     *  circumference = 2 x PI x Radius
     */   
    circumference = 2*PI*radius; 
  
    /*
     * Area of Circle = PI X Radius X Radius 
     */
    area = PI*(radius*radius);  
     
    printf("Circumference of Circle : %.4f\n",circumference);  
    printf("Area of Circle = %.4f\n", area);  
   
    return 0;  
}

Output

Enter Radius of Circle
4.2
Circumference of Circle : 26.3844
Area of Circle = 55.4072