Write a Function C++ 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 three angles is equal to 180 degrees.
Answers
Answered by
1
Answer:
Explanation:
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
Similar questions