input three angles and determine if they form a triangle or not
Answers
Explanation:
: A triangle is valid if sum of its two sides is greater than the third side. If three sides are a, b and c, then three conditions should be met.
1.a + b > c
2.a + c > b
3.b + c > a
C++
// C++ program to check if three
// sides form a triangle or not
#include<bits/stdc++.h>
using namespace std;
// function to check if three sider
// form a triangle or not
bool checkValidity(int a, int b, int c)
{
// check condition
if (a + b <= c || a + c <= b || b + c <= a)
return false;
else
return true;
}
// Driver function
int main()
{
int a = 7, b = 10, c = 5;
if (checkValidity(a, b, c))
cout << "Valid";
mark as brainliest
Explanation:
if the sum of 3 angles is 180 then it is a triangle.
such that all 3 angles should be greater then 0.
i.e no angle should be zero.