Input
Enter Three side of a triangle : 7 8 7
Output
It's an isosceles triangle
Input
Enter Three side of a triangle : 3 8 7
Output
It's an scalene triangle
Step 1: START
Step 2: Take three number 'a','b'and 'c' as an input.
Step 3: Check the condition:
if(a==b && b==c)
print equilateral triangle
else if(a==b || a==c || b==c )
print isosceles triangle
else
print scalene triangle
Step 4: END
/* Check type of triangle */
#include <stdio.h>
int main()
{
int a,b,c;
printf(" Enter three side's of a triangle : ");
scanf("%d%d%d",&a,&b,&c);
if(a==b && b==c)
printf(" It's an equilateral triangle ");
else if(a==b || a==c || b==c )
printf(" It's an isosceles triangle ");
else
printf(" It's an scalene triangle");
return 0;
}
/* Check type of triangle */
#include <iostream>
using namespace std;
int main()
{
int a,b,c;
cout<<" Enter three side's of a triangle : ";
cin>>a>>b>>c;
if(a==b && b==c)
cout<<" It's an equilateral triangle ";
else if(a==b || a==c || b==c )
cout<<" It's an isosceles triangle ";
else
cout<<" It's an scalene triangle";
return 0;
}
Enter three side's of a triangle : 7 8 7
It's an isosceles triangle
advertisment