c++ quetion 2

Write your question here.

Write a short program that reads three non-zero integers from the user input and determines whether the
values could be the sides of a triangle.
Write!:)
If I'm not wrong a triangle exists if the value of two of it's sides is bigger than the third one.


1
2
3
4
5
6
7
8
9
10
11
12
13
    #include<iostream>
    using namespace std;
    
    int main()
    {
      int a, b, c;
      cin >> a >> b >> c;
      
      if(a+b>c && a+c>b && c+b>a) cout << "Yes, there is a triangle!" << endl;
      else cout << "Sorry, there is no such triangle!" << endl;
      system("pause");
      return 0;            
    }
@Snaksa

@Snaksa where is there in the original post written "Snaksa, write a program"?
@vlad from moscow
Yeah you are right, but maybe the author of the post in not very good at Maths and doesn't know when a triangle exists .
Do you want me to delete my previous post?
Last edited on
No, it is a bad idea to remove posts.
Topic archived. No new replies allowed.