program code:
#include<stdio.h>
int main()
 {
  int a,b,c;
  printf("Enter a sides of triangle :\n");
  scanf("%d%d%d",&a,&b,&c);
  if((a==b) && (b==c))
   {
    printf( "\nThe triangle formed by %d,%d,%d  sides is equilateral",a,b,c);
   }
  else if((a==b) || (b==c) || (a==c))
   {
     printf( "\nThe triangle formed by %d,%d,%d  sides is isosceles",a,b,c);
   }
 else
    {
      printf( "\nThe triangle formed by %d,%d,%d  sides is scalene",a,b,c);
     }
return 0;
}
Output:- 
cse@ubumtu:~$gcc
triangle.c - o triangle
cse@ubuntu:~$./triangle
Enter a
sides of triangle :
2
4
6
The triangle
formed by 2,4,6  sides is scalene.
 Enter a sides of triangle :
2
2
2
The triangle
formed by 2,2,2  sides is equilateral
Enter a
sides of triangle :
2
2
3
The triangle
formed by 2,2,3  sides is isosceles.
Screen shot:-


No comments:
Post a Comment