-
Lenguaje
C++
-
Descripción
Dado un triángulo de lados a, b y c, donde a > c y a > b. Determine el tipo de triángulo de acuerdo a las siguientes condiciones:
Si a2 = b2 + c2 -> es un triángulo rectángulo.
Si a2 < b2 + c2 -> es un triángulo acutángulo.
Si a2 > b2 + c2 -> es un triángulo obtusángulo.
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
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
#ifdef __MSDOS__
#include <iostream.h>
#include <stdlib.h>
#else
#include <iostream>
#include <cstdlib>
using namespace std;
#endif
int main (void)
{
float a, b, c;
cout << "Ingresa el valor de a: ";
cin >> a;
cin.get();
cout << "Ingresa el valor de b: ";
cin >> b;
cin.get();
cout << "Ingresa el valor de c: ";
cin >> c;
cin.get();
if(a*a==b*b+c*c)
cout << "Rect\240ngulo" << endl;
if(a*a<b*b+c*c)
cout << "Acut\240ngulo" << endl;
if(a*a>b*b+c*c)
cout << "Obtus\240ngulo" << endl;
cout << endl;
system ("pause");
return EXIT_SUCCESS;
}
#include <iostream.h>
#include <stdlib.h>
#else
#include <iostream>
#include <cstdlib>
using namespace std;
#endif
int main (void)
{
float a, b, c;
cout << "Ingresa el valor de a: ";
cin >> a;
cin.get();
cout << "Ingresa el valor de b: ";
cin >> b;
cin.get();
cout << "Ingresa el valor de c: ";
cin >> c;
cin.get();
if(a*a==b*b+c*c)
cout << "Rect\240ngulo" << endl;
if(a*a<b*b+c*c)
cout << "Acut\240ngulo" << endl;
if(a*a>b*b+c*c)
cout << "Obtus\240ngulo" << endl;
cout << endl;
system ("pause");
return EXIT_SUCCESS;
}