Using a function write a c++ program to calculate the area of a circle ?

i try this but i dont know it right way or not
#include <iostream>
using namespace std;
float area(float radius);
int main()
{

float area ,radius;
float pi=3.14;
cout<<"Enter the radius : ";
cin>>radius;

area=3.14*(radius*radius);

cout<<"The area of cirle is :"<<area<<endl; 

system("pause");

    return (area);
}

0 comments: