Write a program that computes the area of a circle. The formula to find the area of a circle is:
- area = PI*R*R. The value of PI is 3.1417.
- Store the value of PI in a constant using ‘define’ directive
#include<iostream.h>
#include<conio.h>
#define PI 3.1417
void main(void)
{
float R, area;
R = 10;
area = PI*R*R;
clrscr();
cout << "Area of a circle is = " << area;
getch();
}
Post a Comment