Question #31204

Write a program to calculate area of circle using friend function ?

Expert's answer

#include <iostream>

#include <math.h>

using namespace std;

int area(double R)

{

double AREA2=0;

double Pi=3.14159265358979;

AREA2= Pi*R*R;

cout<<AREA2;

}

int main()

{

double r;

cout<<"enter R"<<endl;

cin>>r;

area(r);

return 0;

}

#include <math.h>

using namespace std;

int area(double R)

{

double AREA2=0;

double Pi=3.14159265358979;

AREA2= Pi*R*R;

cout<<AREA2;

}

int main()

{

double r;

cout<<"enter R"<<endl;

cin>>r;

area(r);

return 0;

}

## Comments

## Leave a comment