Here is the program to check a triangle is equilateral, isosceles or scalene.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include "conio.h" #include "stdio.h" void main() { int x,y,z; printf("\nEnter the sides of a triangle"); scanf("%d %d %d",&x,&y,&z); if((x==y) && (y==z)) { printf("\nThe triangle is equilateral"); } else if((x==z) || (y==z) || (x==y)) { printf("\nThe triangle is isoseles"); } else { printf("\nThe triangle is scalene"); } getch(); } |
Output:
Enter the sides of a triangle 12 10 12 The triangle is isoseles |
In 1st and 2nd line angle bracket will used surrounding sutdio.h or conio.h… these “” commas will not use.
my program cant differentiate between a scalene and an isosceles triangle