#include<iostream.h>
#include<conio.h>
float circle(float);
void main()
{
float r, k;
clrscr();
cout<<"Enter radius of circle: ";
cin>>r;
k = circle(r);
cout<<"Area of circle is : "<<k;
}
float circle(float m)
{
float area;
area = 3.142 * m * m;
return area;
}
Using MACROS
#include<iostream.h>
#include<conio.h>
#define PI 3.142
float circle(float);
void main()
{
float r, k;
clrscr();
cout<<"Enter radius of circle: ";
cin>>r;
k = circle(r);
cout<<"Area of circle is : "<<k;
}
float circle(float m)
{
float area;
area = PI * m * m;
return area;
}