4.Write a program to check whether a triangle is valid or not, when the three angles of triangle are entered through the keyboard. A triangle is valid if the sum of all three angles is equal to 180 degrees.

Posted: September 17, 2012 in CSE Sem1, ECE Sem1, Lab 10B, Lab 10B
#include<stdio.h>
void main()
{
float a,b,c,sum;
printf("enter three angles a,b,c");
scanf("%f%f%f",&a,&b,&c);
sum=a+b+c;
if(sum==180)
printf("triangle is valid");
else
printf("triangle is not valid");
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s