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.  










9 comments:

Anonymous said...

This program is easy to understand..

Anonymous said...

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

Anonymous said...

when the %f\n derived

Anonymous said...

why use %f\n instead of %f

Anonymous said...

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

Anonymous said...

some escape sequences unnecessary

Anonymous said...

\n for space

vamsi said...

I planing to write algorithm part of my project work question is following
problem is finding intersection of between two ellipses
(x-x1)^2/a^2+(y-y1)^2/b^2=1,(x-x2)^2/c^2+(y-y2)^2/d^2=1 (x1,y1),(x2,y2) point of ellipse and a,b,c,d are major and minor axis of ellipses
please provide any idea of how to find out intersection of two ellipses

Usman Rehan said...

"/n" is used to print in new line