-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTriangulo.cpp
More file actions
42 lines (32 loc) · 841 Bytes
/
Triangulo.cpp
File metadata and controls
42 lines (32 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
Leia 3 valores reais (A, B e C) e verifique se eles formam
ou não um triângulo. Em caso positivo, calcule o perímetro
do triângulo e apresente a mensagem:
Perimetro = XX.X
Em caso negativo, calcule a área do trapézio que tem A e B
como base e C como altura, mostrando a mensagem
Area = XX.X
Entrada
A entrada contém três valores reais.
Saída
O resultado deve ser apresentado com uma casa decimal.
https://www.beecrowd.com.br/judge/pt/problems/view/1043
*/
#include <iostream>
#include <iomanip>
using namespace std;
void fixo() {
cout << fixed << setprecision(1);
}
int main() {
double a, b, c;
cin >> a >> b >> c;
if (b + c > a && a + c > b && a + b > c) {
fixo();
cout << "Perimetro = " << a + b + c << endl;
} else {
fixo();
cout << "Area = " << ((a + b) * c) / 2 << endl;
}
return 0;
}