C PROGRAM TO CALCULATE AREA OF A CIRCLE




C program for area of circle


#include <stdio.h>
#define PI 3.141
int main(){
  float r, a;
  printf("Radius: ");
  scanf("%f", &r);
  a = PI * r * r;
  printf("%f\n", a);
  return 0;
}



Mathematical formula for area of circle: 






 

Here Pie is constant which is equal to

Pie = 22/7 or 3.14159265358979323846264338327950288419716939937510...



Radius is radius of the circle.  










7 comments:

  1. This program is easy to understand..

    ReplyDelete
  2. There are a few things wrong with this.
    First, it's spelled "pi"
    Second, 22/7 is not equal to "pi"

    ReplyDelete
  3. when the %f\n derived

    ReplyDelete
  4. why use %f\n instead of %f

    ReplyDelete
  5. \n is used to print after some space... aksh

    ReplyDelete
  6. some escape sequences unnecessary

    ReplyDelete