Advertisement
Md_Touhid

URI - Problem 1012 - Area

Apr 14th, 2020
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. #include<iostream>
  2. #include<iomanip> //for setprecision()
  3. #include<cmath> //for pow()
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     double pi = 3.14159, a, b, c;
  10.  
  11.     cin >> a;
  12.     cin >> b;
  13.     cin >> c;
  14.  
  15.     double area_of_triangle = 0.5 * a * c;
  16.     double area_of_circle = pi * pow(c, 2);
  17.     double area_of_trapezium = ((a+b) * c)/2;
  18.     double area_of_square = pow(b, 2);
  19.     double area_of_rectangle = a*b;
  20.  
  21.     cout << "TRIANGULO: " << fixed << setprecision(3) << area_of_triangle << endl;
  22.     cout << "CIRCULO: " << fixed << setprecision(3) << area_of_circle << endl;
  23.     cout << "TRAPEZIO: " << fixed << setprecision(3) << area_of_trapezium << endl;
  24.     cout << "QUADRADO: " << fixed << setprecision(3) << area_of_square << endl;
  25.     cout << "RETANGULO: " << fixed << setprecision(3) << area_of_rectangle << endl;
  26.  
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement