#include<stdio.h>
main()
{
int a,b,c;
char ch;
do{
printf(“Enter the lengths of the three sides of the triangle”);//to check if a triangle can be formed
scanf("%d%d%d",&a,&b,&c); //Property : the sum of two sides of a triangle should be greater than the third side
printf("",((a+b)>c&&(b+c)>a&&(c+a)>b)?printf(“Triangle is possible”):printf(“Not possible”));
printf("",a==b&&b==c?printf("\nEquilateral Traingle"):(a!=b&&a!=c?printf("\nScalene triangle"):printf("\nIsosceles triangle")));
printf("\nwould you like to enter sides again?(y/n)");
scanf("%c",&ch);
}while(ch==‘y’||ch==‘Y’);
}
Please format this code or provide ideone link and also provide the question link too
You’re welcome dear
Hey Buddy,
I’m not sure what’s your problem, but looking at your problem it looks that you want to make the program for checking whether a triangle is equilateral, isosceles or scalene triangle. Instead of using such complex structure I would suggest you to use if-else conditions.
If this is not the case, please comment i will try to help.
Hope this helps!