I'm having a problem with this code in DevC ++, as I see the part of the if-else
conditions is perfectly indented and organized (all if
has its else
and its keys). The error is in the last else
, but I do not know how to solve it, because I need this condition.
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch,
system("pause") or input loop */
int main(int argc, char *argv[]) {
int a, b, c;
char equi[] = "Triangulo equilatero.";
char isos[] = "Triangulo isosceles." ;
char esc [] = "Triangulo escaleno." ;
scanf("%d", &a);
scanf("%d", &b);
scanf("%d", &c);
if ((a > 0) && (b > 0) && (c > 0) && (a<(b+c)) && (b<(a+c)) && (c<(a+b)))
{
if( (a==b) && (b==c) )
{
printf("%s", equi);
}else{
if( (a==b) || (b==c) || (c==a) )
{
printf("%s", isos);
}else{
printf("%s", esc);
}
}
/* O problema está aqui neste ultimo else abaixo, pois se eu retirar essa
linha o programa compila. No entanto se eu deixar, dá um erro "id returned 1
exit status".*/
}else{
print("Nao e possivel formar um triangulo.");
}
return 0;
}