I have an interesting problem in my code, the program reads three numbers and says whether it is a triangle rectangle or not, but the problem is that depending on the sequence I type the numbers, program the error because the higher value typed must be that of the hypotenuse and both the other two legs, if I enter 3, 4, 5, the value of 5 needs to be stored in the variable hypotenuse, but how do I, 5, 4, 3 right but the opposite not ...
#include <stdio.h> //Inclusao da bibilioteca principal
#include <math.h> //Inclusao da biblioteca para uso da funcao "pow" e "sqrt"
int main (void) //Declaracao do corpo principal do programa
{
int hip, cat1, cat2; //Declaracao de variaveis hipoteusa, cateto 1 e cateto 2
scanf("%d", &hip); //Insercao pdo valor da hipotenusa
scanf("%d", &cat1); //Insercao do valor do cateto 1
scanf("%d", &cat2); //Insercao do valor do cateto 2
if (hip == sqrt(pow(cat1,2) + pow(cat2,2))) //Condicao para caso o valor da hipotenusa seja igual a raiz quadrada da soma dos quadrados dos catetos
{
printf("SIM"); //Caso a condicao acima seja verdade, imprimi na tela a palavra SIM
} else {
printf("NAO"); //Caso a condicao acima nao for satisfeita, imprimi na tela a palavra NAO
}
return 0;
}