0
#include<stdio.h>
#include<stdlib.h>
#include<locale.h>
#include<conio.h>
#include<math.h>
int retangulo(int a, int b, int c){
int maior;
if(a>b && a>c){// iníco primeira verificação...
maior = a;
if( pow(maior,2) == pow(b,2) + pow(c,2) ){
printf("\n Verdadeiro...");
}
}// fim primeira verificação...
else if(b>a && b>c){// iníco segunda verificação...
maior = b;
if( pow(maior,2) == pow(a,2) + pow(c,2) ){
printf("\n Verdadeiro...");
}
}// fim segunda verificação...
else if(c>a && c>b){// iníco terceira verificação...
maior = c;
if( pow(maior,2) == pow(a,2) + pow(b,2) ){
printf("\n Verdadeiro...");
}
}// fim terceira verificação...
else{
printf("\n Falso...");
}
}
int main(){
setlocale(LC_ALL,"ptb");
int l1, l2, l3, X;
printf("\n Digite quatro valores inteiros:\n");
scanf("%d%d%d", &l1, &l3, &l3);
X = retangulo(l1,l2,l3);
getch();
return 0;
}
Take care of equality comparisons for float/double variables. As approximate values may be the comparison may not be true when you judge it to be. Use of round function can eliminate this possible problem.
– anonimo