include iostream include math using namespace std double area double r

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#include <iostream>
#include <math.h>
using namespace std;
double area(double r) {
return M_PI * pow(r, 2);
}
int main() {
double r;
cout << "Enter the radius of the circle: ";
cin >> r;
cout << "The area of a circle with a radius of " << r << " is equal to: " << area(r) << endl;
return 0;
}