Write a C++ program to input the angles of a triangle and check whether the triangle is valid or not but using the if-else statement.

## Flowchart of the program to input angles of a triangle and check whether the triangle is valid or not but using the if-else statement.

## C++ Source code to input angles of a triangle and check whether the triangle is valid or not but using the if-else statement.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#include<iostream> using namespace std; int main() { int a; int b; int c; cout<<"enter three angle of a triangle"<<endl; cin>>a>>b>>c; int sum=a+b+c; if(sum==180 && a!=0 && b!=0 && c!=0) { cout<<"the triangle is valid"<<endl; } else { cout<<"the triangle is not valid"<<endl; } } |

Output

enter three angles of a triangle

3

8

9

the triangle is not valid

## SFT (Shamil’s Flow Table )

Are you interested to Read about SFT(Shamil’s Flow Table)?

Latest posts by Prof. Fazal Rehman Shamil (see all)

- List of Public service commissions - August 31, 2020
- Comparison of fee structure of Pakistani Universities - June 1, 2020
- Past Guess Paper of Auditing - May 12, 2020