Write a program in C++ to input any three angles and to print whether a triangle is possible with those angles or not.
Answers
Answer:
Input all three angles of triangle in some variable say angle1 , angle2 and angle3 . ... Check if(sum == 180) then, triangle can be formed otherwise not. In addition, make sure angles are greater than 0 i.e. check condition for angles if(angle1 > 0 && angle2 > 0 && angle3 > 0) .
वन्देमातरम्
If the three sides of a triangle are entered through the keyboard, write a C++ program to check whether the triangle is valid or not. The triangle is valid if the sum of two sides is greater than the largest of the three sides.
#include<math.h>#include<iostream>using namespace std;void main()//programology{int a,b,c;cout<<"The side of a Is:"<<endl;//programologycin>>a;cout<<"The side of b is:"<<endl;cin>>b;cout<<"The side of c is:"<<endl;cin>>c;if(a+b>c)cout<<"The triangle is valid"<<endl;else if(a+c>b)cout<<"The triangle is valid"<<endl;else if(c+b>a)cout<<"The triangle is Valid"<<endl;elsecout<<"TRiangle is invalid"<<endl;}