C Program to Check Type of Triangle

C Program to Check Type of Triangle

Write a Program to Check Type of Triangle

// C Program to Check Type of Triangle

#include<stdio.h>
int main()
{
   int side1, side2, side3;

   printf("Enter Length of Side 1 :--> ");
   scanf("%d", &side1);

   printf("Enter Length of Side 2 :--> ");
   scanf("%d", &side2);

   printf("Enter Length of Side 3 :--> ");
   scanf("%d", &side3);

   if(side1 == side2 && side2 == side3)
      printf("Given Triangle is Equilateral\n");

   else if(side1 == side2 || side2 == side3 || side3 == side1)
      printf("Given Triangle is Isosceles\n");

   else
      printf("Given Triangle is Scalene\n");

   return 0;
}

Output:

Run - 1:
Enter Length of Side 1 :--> 5
Enter Length of Side 2 :--> 5
Enter Length of Side 3 :--> 5

Given Triangle is Equilateral

Run - 2:
Enter Length of Side 1 :--> 10
Enter Length of Side 2 :--> 5
Enter Length of Side 3 :--> 10

Given Triangle is Isosceles

Run - 3:
Enter Length of Side 1 :--> 5
Enter Length of Side 2 :--> 6
Enter Length of Side 3 :--> 7

Given Triangle is Scalene