The program aims to identify whether a triangle is equilateral, isosceles or scalene. But there is an error in the isosceles identification line, where if the user places values of equal entries on the first two sides and different in the last, it is not recognized.
Example:
- measure of side1:
3
; - measure of side2:
4
; - measure of side3:
2
;
Code:
#include<stdio.h>
int main(){
int L1,L2,L3;
int equilatero,isoceles,escaleno;
printf("media do lado1:");
scanf("%d",&L1);
printf("media do lado2:");
scanf("%d",&L2);
printf("media do lado3:");
scanf("%d",&L3);
equilatero = (L1 == L2)&&(L1 == L3);
printf("seu triangulo eh equilatero: %d\n",equilatero);
isoceles = ((L1==L2)||(L1==L3)||(L2==L3))&&((L1!=L2)||(L2=!L3)||(L1=!L3));
printf("seu triangulo eh isoceles: %d \n",isoceles);
escaleno = (L1 != L2)&&(L2 != L3)&&(L1 != L3);
printf("seu triangulo eh escaleno: %d \n",escaleno);
return 0;
}