I'm trying to get my program to identify a triangle and tell me if it's Equilateral, isosceles or scalene. I am a beginner in the C language, so I created a structure with If / Else to analyze the conditions to identify if the value entered corresponds to a triangle, if yes tell me which type of triangle corresponds and if it does not correspond to a triangle inform that the data entered do not match.
But my problem is that any value entered the program says that the value does not correspond to a triangle.
I wonder if anyone can help me understand my error ??
int main () {
//VARIAVEIS
float A = 0;
float B = 0;
float C = 0;
printf ("\nCALCULANDO UM TRIANGULO!\n");
printf ("\nDIGITE OS VALORES DOS CATETOS:\n");
getch();
printf ("\nDIGITE O VALOR DE (A):\n");
scanf("%f", &A);
printf ("\nDIGITE O VALOR DE (B):\n");
scanf("%f", &B);
printf ("\nDIGITE O VALOR DE (C):\n");
scanf("%f", &C);
printf ("\nOS VALORES DIGITADOS: %.2fcm %.2fcm %.2fcm\n", A , B , C);
printf ("\nPRESSIONE ENTER...\n");
getch ();
if ((A + B < C) || (B + C < A) || (A + C < B)) {
printf ("\nVAMOS CALCULAR O TRIANGULO\n");
if ((A == B) && (B == C)) {
printf ("\nTRIANGULO EQUILATERO!\n");
}
else {
if((A == B) || (A == C) || (B == C)) {
printf ("\nTRIANGULO ISOCELES!\n");
}
else {
printf ("\nTRIANGULO ESCALENO!\n");
}
}
}
else {
printf ("\nVALORES NAO CORRESPONDEM A UM TRIANGULO!\n");
}