WAP in C++ to check whether a triangle is valid or not, when the three angles of the triangle are entered by the user. A triangle is valid if the sum of all the three angles is equal to 180 degrees.
#include<iostream.h>#include<conio.h>int main(){int ang1,ang2,ang3;cout<<"Enter the three angles of triangle:";cin>>ang1>>ang2>>ang3;if (ang1+ang2+ang3==180)cout<<"Triangle is valid";elsecout<<"Triangle is not valid";getch();return 0;}
Comments
Post a Comment