// ### task CIRCLE AREA ### /* ### Description ### There is a length of a circle. Find the area of the circle. Input: A positive real number, the length of the circle. Output: A real number, the area of the circle. */ #include #include #define _USE_MATH_DEFINES #include #ifndef M_PI #define M_PI 3.14159265358979323846 #endif using namespace std; int main() { //lenght of circle double l; //reading length cin >> l; //area of circle double s; /* know: l = 2 * pi * r; s = pi * r^2; l^2 = 4 * pi^2 * r^2; l^2 / (4 * pi) = pi * r^2; l^2 / (4 * pi) = s; so: s = l^2 / (4 * pi); */ //calculate the area s = pow(l, 2) / (4 * M_PI); //printing area of circle cout << fixed << setprecision(9) << s; return 0; }