Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int num1, num2,num3;
  6. cout << "enter 3 numbers:" << endl;
  7. cin >> num1 >> num2 >> num3;
  8.  
  9. if ((num1 + num2 > num3) && (num2 + num3 > num1) && (num3 + num1 > num2)) {//checks if it can be a triangle.
  10.  
  11. if (num1 == num2 && num1 == num3 && num2 == num3) { //checks if the triangle can be equilateral.
  12. cout << "equilateral triangle" << endl;
  13.  
  14. }
  15. else
  16. if (num1 == num2 || num1 == num3||num2==num3) {//checks if it's a isosceles triangle.
  17. cout << "isosceles triangle" << endl;
  18. }
  19. else
  20. if (num1 != num2 && num1 != num3 && num2 != num3) {//checks if it's a scalene triangle.
  21. cout << "scalene triangle" << endl;
  22.  
  23. }
  24.  
  25. }
  26. else
  27. cout << "cannot form a triangle" << endl;
  28.  
  29.  
  30.  
  31. // system("pause");
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement