C Program to Check Whether a Triangle is Valid or Not If Angles are Given ?
Q:- Write a C Program to Check Whether a Triangle is Valid or Not If
Angles are Given ?
Input
#include<stdio.h>
#include<conio.h>
int main()
{
int a1,a2,a3,sum;
clrscr();
printf(“Enter Three Angles of
Triangle =”);
scanf(“%d%d%d”,&a1,&a2,&a3);
sum = a1+a2+a3;
if(sum == 180 && a1 !=0
&& a2!=0 && a3!=0)
{
printf(“Triangle is Valid.”);
}
else
{
printf(“Triangle is not Valid.”);
}
getch();
}
Output
Enter Three
Angles of Triangle =
30
60
90
Triangle is
Valid.
Comments
Post a Comment