An algorithm to check whether the triangle is isosceles, equilateral, scalene or right angled triangle.

  1. START
  2. Enter the 3 sides of the Triangle as s1, s2 and s3.
  3. Check if(s1==s2 && s1==s3) then continue else GOTO Step 6
  4. Print given Triangle is equilateral
  5. Goto Step 13
  6. Check if(s1==s2 || s1==s3 || s2==s3) then continue else GOTO Step 9
  7. Print the given Triangle is isosceles
  8. Goto Step 13

9 Check if(s1*s1==s2*s2+s3*s3 || s2*s2==s1*s1+s3*s3  || s3*s3==s1*s1+s2*s2) then continue else GOTO Step 12

  1. Print the given triangle is right angle triangle
  2. Goto Step 13
  3. Print the given Triangle is Scalene
  4. END

Flowchart to check whether the triangle is isosceles, equilateral, scalene or right angled triangle.

Flowchart to check whether the triangle is isosceles, equilateral, scalene or right angled triangle.
Flowchart to check whether the triangle is isosceles, equilateral, scalene or right angled triangle.

If the three sides of a triangle are entered through the keyboard, C-Code to check whether the triangle is isosceles, equilateral, scalene or right angled triangle.

#include<stdio.h>
void main()
{
int s1,s2,s3;
printf("Enter three sides of the triangle s1,s2,s3 :");
scanf("%d%d%d",&s1,&s2,&s3);
if(s1==s2  && s1==s3)
printf("\n The given triangle is equilateral");
else if(s1==s2 || s1==s3 || s2==s3)
printf("\n The given triangle is isosceles :");
else if(s1*s1==s2*s2+s3*s3 || s2*s2==s1*s1+s3*s3  || s3*s3==s1*s1+s2*s2)
printf("\nThe given triangle is right angle triangle");
else
printf("\nThe given triangle is scalene");
}