This blog consists of C and C++ programs. C and C++ programming is the basics to learn any programming language. Most of the programs are provided with their respective outputs. This blog also contains Data Structures programs using Object-Oriented Programming (C++). Some of the best books for learning C and C++ programming are also mentioned.

Tuesday 30 July 2013

Program to find the type of Triangle

#include<stdio.h>
#include<math.h>
int main()
{
int a, b, c;
clrscr();
printf("Enter the values of the sides of the triangle: \n");
scanf("%d %d %d", &a, &b, &c);
if ((a + b > c && a + c > b && b + c > a) && (a > 0 && b > 0 && c > 0))
{
if (a == b && b == c)
{
printf("Equilateral Triangle");
}
else if (a == b || b == c || a == c)
{
printf("Isosceles Triangle");
}
else
{
printf("Scalene Triangle");
}
}
else
{
printf("Triangle formation is not possible");
}
getch();
}


No comments:

Post a Comment