Write a program 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.

Source Code

#include<iostream>
using namespace std;

int main()
{
	int angle1,angle2,angle3;
	cout<<"Enter the three angles of triangle:";
	cin>>angle1>>angle2>>angle3;

	if (angle1+angle2+angle3==180)
		cout<<"Triangle is valid";
	else
		cout<<"Triangle is not valid";

	
	return 0;
}


Output

SAMPLE RUN # 1

Enter the three angles of triangle:60 50 50
Triangle is not valid

SAMPLE RUN # 2

Enter the three angles of triangle:60 90 30
Triangle is valid