/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include <stdio.h>
int main()
{
double a, b, c, temp;
scanf("%lf %lf %lf", &a, &b, &c);
if (a < b)
{
temp = a;
a = b;
b = temp;
}
if (b < c)
{
temp = b;
b = c;
c = temp;
}
if (a < b)
{
temp = a;
a = b;
b = temp;
}
if (a >= b + c)
{
printf("NAO FORMA TRIANGULO\n");
}
else if (a * a == b * b + c * c)
{
printf("TRIANGULO RETANGULO\n");
}
else if (a * a > b * b + c * c)
{
printf("TRIANGULO OBTUSANGULO\n");
}
else if (a * a < b * b + c * c)
{
printf("TRIANGULO ACUTANGULO\n");
}
if (a == b && b == c)
{
printf("TRIANGULO EQUILATERO\n");
}
else if (a == b || b == c)
{
printf("TRIANGULO ISOSCELES\n");
}
return 0;
}
//Happy_Coding
#include <stdio.h>
int main()
{
double a, b, c, temp;
scanf("%lf %lf %lf", &a, &b, &c);
if (a < b)
{
temp = a;
a = b;
b = temp;
}
if (b < c)
{
temp = b;
b = c;
c = temp;
}
if (a < b)
{
temp = a;
a = b;
b = temp;
}
if (a >= b + c)
{
printf("NAO FORMA TRIANGULO\n");
}
else if (a * a == b * b + c * c)
{
printf("TRIANGULO RETANGULO\n");
}
else if (a * a > b * b + c * c)
{
printf("TRIANGULO OBTUSANGULO\n");
}
else if (a * a < b * b + c * c)
{
printf("TRIANGULO ACUTANGULO\n");
}
if (a == b && b == c)
{
printf("TRIANGULO EQUILATERO\n");
}
else if (a == b || b == c)
{
printf("TRIANGULO ISOSCELES\n");
}
return 0;
}
//Happy_Coding
No comments:
Post a Comment