Home > Backend Development > C++ > In a C program, translate the following into Chinese: What is the area of ​​a decagon depicted in a circle?

In a C program, translate the following into Chinese: What is the area of ​​a decagon depicted in a circle?

WBOY
Release: 2023-09-09 11:49:02
forward
1257 people have browsed it

In a C program, translate the following into Chinese: What is the area of ​​a decagon depicted in a circle?

A regular decagon is a decagon with all sides and angles equal. Here we need to use the radius r of the circle to find the area of ​​the decagon inscribed in the circle,

The mathematical formula for the side of the decagon inscribed in the circle,

a = r&radic;(2-2cos36<sup>o</sup>)
Copy after login

(using the cosine rule )

The formula for finding the area of ​​a decagon,

Area = 5*a<sup>2</sup>*(&radic;5+2&radic;5)/2
Area = 5 *(r&radic;(2-2cos36))^<sup>2</sup>*(&radic;5+2&radic;5)/2
Area = (5r<sup>2</sup>*(3-&radic;5)*(&radic;5+2&radic;5))/4
Copy after login

Use this formula in the program,

Example

#include <stdio.h>
#include <math.h>
int main() {
   float r = 8;
   float area = (5 * pow(r, 2) * (3 - sqrt(5))* (sqrt(5) + (2 * sqrt(5))))/ 4;
   printf("area = %f",area);
   return 0;
}
Copy after login

Output

area = 409.968933
Copy after login

The above is the detailed content of In a C program, translate the following into Chinese: What is the area of ​​a decagon depicted in a circle?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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