Thursday 25 July 2013

Chapter 2 solutions Problem [C][g]

Question-Write a program to check whether a triangle is valid or not,
when the three angles of the triangle are entered through the
keyboard. A triangle is valid if the sum of all the three angles
is equal to 180 degrees.
Solution- 
I have escaped problem of age of 3 brother. that's really basic, but you guys shouldn't leave problem like that. if anyone gets stuck in that. you are always welcome to E-mail me. This is also a basic problem. check out it's solution.

#include<stdio.h>
int main()
{
float a,b,c;
printf("Enter the angles\n");
scanf("%f%f%f",&a,&b,&c);
if(a+b+c==180)
printf("Valid Traingle\n");
else
printf("not a valid Traingle\n");
return 0;
}  

No comments:

Post a Comment