Home > Backend Development > C++ > body text

In a C program, translate the following into Chinese: Area of ​​the circumcircle of a right triangle

WBOY
Release: 2023-08-28 22:53:05
forward
717 people have browsed it

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

In a C program, translate the following into Chinese: Area of ​​the circumcircle of a right triangle

so the area is -

In a C program, translate the following into Chinese: Area of ​​the circumcircle of a right triangle

Example code

#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);
}
Copy after login

Output

Area : 50.264
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template