C Program to Find Out the Type of Triangle

How to Find Out the Triangle Type in C

The program to find out the Triangle Type written in C let you know the type of triangle for the given values of triangle

Triangle Types

1. Isosceles Triangle is the triangle type have at least 2 equal sides
2. Scalene Triangle: All sides are unequal. The three angles are also all different in measure. Some, but not all scalene triangles are also right triangles
3. Equilateral Triangle: All sides have the same length. An equilateral triangle is also a regular polygon with all angles measuring 60

C Program to Find Out the Triangle Type

#define NONE -1
#define ISOSCELES 1
#define SCALENE 3

int isTriangle(int a, int b, int c)
if(a < 1 || b < 1 || c < 1)
return NONE;
if(a+b <= c || a+c <= b || c+b <= a)
return NONE;
if(a == b && a == c)
if(a == b || b == c || a == c)
return SCALENE;

int main()
printf("%d\n", isTriangle(11,10,17));
printf("%d\n", isTriangle(11,10,11));
printf("%d\n", isTriangle(11,11,11));
printf("%d\n", isTriangle(11,110,11));
printf("%d\n", isTriangle(11,0,11));
return 0;

Related Topic Basic Linux Commands
JSTL tag Choose When Example Code
Mac OS X Custom Slide Show Screen Saver from Command Line
A to Z Linux Commands quick reference sheet
Credit Card Number Validation Java

nScraps.com 2011   Privacy Policy  Terms of Service  Feedback