Advertisement
Guest User

Untitled

a guest
Apr 5th, 2020
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. float area(int x);
  7.  
  8. int main() {
  9.     setlocale(LC_ALL, "Rus");
  10.     int n;
  11.     cout << "Введите длину ребра: ";
  12.     cin >> n;
  13.     cout << "Площадь полной поверхности пирамиды равна: " << area(n);
  14. }
  15.  
  16. float area(int x) {
  17.     double So, Sb, S, h, P;
  18.     So = (5 * pow(x, 2)) / (4 * tan(180 / 5));
  19.     P = 5 * x;
  20.     h = (x * sqrt(3)) / 2;
  21.     Sb = (P + h) / 2;
  22.     S = So + Sb;
  23.     return S;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement