pages

Saturday, 10 April 2021

If the three sides of the triangle is entered form the keyboard, write a program to check weather the triangle is equilateral or isosceles or scalene triangle.

 Q.no If the three sides of the triangle is entered  form the keyboard, write a program  to check weather the triangle is equilateral or isosceles or scalene triangle.

In this program ,we will making a program by which user entering the values of the sides of a triangle and check weather the triangle is equilateral or isosceles or scalene triangle.
As we know that if all the sides of the triangle is equal than it is equilateral triangle
and if only two sides of a triangle is equal than isosceles triangle , and if all sides are different then the triangle is scalene triangle.


#include<stdio.h>
#include<conio.h>
void main()
{
   int a,b,c;
   printf("enter the values of sides of a triangle");
   scanf("%d %d %d",&a,&b,&c);
   if(a==b&&b==c&&a==c)
         printf("\n equilateral triangle");
   else{
         if(b==c||a==b||a==c)
              printf("\n isosceles triangle");
         else
             printf("\n scalane triangle");
   }
    getch();
}


output:- enter the values of the sides of a triangle a=3 b=5 c=3

                  the triangle is isosceles triangle

1 comment: