Home >Backend Development >C++ >In a C program, translate the following into Chinese: Area of the circumcircle of a right triangle
Here we will learn how to obtain the area of the circumcircle of a right triangle. The hypotenuse of the triangle forms the diameter of the circle. So if the hypotenuse is h, the radius is h/2
so the area is -
#include <iostream> #include <cmath> using namespace std; float area(float h) { if (h < 0) //if h is negative it is invalid return -1; float area = 3.1415 * (h/2) * (h/2); return area; } int main() { float h = 8; cout << "Area : " << area(h); }
Area : 50.264
The above is the detailed content of In a C program, translate the following into Chinese: Area of the circumcircle of a right triangle. For more information, please follow other related articles on the PHP Chinese website!