Program to accept three sides of a triangle in same unit and check whether it is an Equilateral Isosceles or Scalene triangle or not. Also check if the triangle is possible or not.
C
#include <stdio.h>
int main()
{
int a=0,b=0,c=0;
printf("Enter three sides of the triangle:-\n");
printf("Side A: ");
scanf("%d",&a);
printf("Side B: ");
scanf("%d",&b);
printf("Side C: ");
scanf("%d",&c);
if(a<=0||b<=0||c<=0)
{
printf("INVALID INPUT! TRIANGLE IS NOT POSSIBLE.");
}
else if(a==b&&b==c)
{
printf("It is a Equilateral Triangle.");
}
else if(a==b||b==c||a==c)
{
printf("It is a Isosceles Triangle.");
}
else
{
printf("It is a Scalene Triangle.");
}
return 0;
}C