+ 1

Calculating area of a circle in c++

Someone help me

28th May 2019, 2:41 PM
Steven Alukwe
Steven Alukwe - avatar
4 Answers
+ 3
,thanks agent smith
28th May 2019, 2:50 PM
Steven Alukwe
Steven Alukwe - avatar
+ 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
28th May 2019, 2:49 PM
AgentSmith
+ 1
huh, it appears as though sololearn has pi #define _USE_MATH_DEFINES #include <cmath> cout << M_PI;
28th May 2019, 4:51 PM
Choe
Choe - avatar