+ 1
Calculating area of a circle in c++
Someone help me
3 Réponses
+ 3
,thanks agent smith
+ 2
https://code.sololearn.com/cllY0b806EN9/#cpp
#include <iostream>
using namespace std;
int main() {
float rad;
float result;
const float pi = 3.14;
cout << "What is the radius? ";
cin >> rad;
cout << rad << endl;
result = pi * rad * rad;
cout << "Area = " << result << endl;
return 0;
}
::::: OUTPUT :::::
What is the radius? 10
Area = 314
What is the radius? 25
Area = 1962.5
What is the radius? 5
Area = 78.5
+ 1
huh, it appears as though sololearn has pi
#define _USE_MATH_DEFINES
#include <cmath>
cout << M_PI;