You are here

C program to find area of circle

C program to find area of circle: c programming code to calculate area of circle.

C programming code

  1. #include<stdio.h>
  2. #include<math.h>
  3.  
  4. main()
  5. {
  6.    float radius, area;
  7.    
  8.    printf("Enter the radius of circle\n");
  9.    
  10.    scanf("%f",&radius);
  11.    
  12.    /* M_PI (pi) is a constant in math.h header file */
  13.  
  14.    area = M_PI*radius*radius;  
  15.    
  16.    printf("Area of circle = %.2f\n", area);
  17.    
  18.    return 0;
  19. }