counter

Free Hit Counter

C program to check validity of triangle


Q:Write a c program to check whether a triangle is valid or not ..when the three angles of the triangle are entered through keyboard.A triangle is valid if sum of all angles is 180

#include
#include
void main()
{
int A1,A2,A3;
clrscr();
printf("enter three angles: ");
scanr("%d",&A1);
scanf("\n%d",&A2);
scanf("\n%d",&A3);
if(A1+A2+A3==180)
{
printf("valid tringle");
}
else
{
printf("invalid tringle");
}
getch();
}

No comments:

Post a Comment