Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- int num1, num2,num3;
- cout << "enter 3 numbers:" << endl;
- cin >> num1 >> num2 >> num3;
- if ((num1 + num2 > num3) && (num2 + num3 > num1) && (num3 + num1 > num2)) {//checks if it can be a triangle.
- if (num1 == num2 && num1 == num3 && num2 == num3) { //checks if the triangle can be equilateral.
- cout << "equilateral triangle" << endl;
- }
- else
- if (num1 == num2 || num1 == num3||num2==num3) {//checks if it's a isosceles triangle.
- cout << "isosceles triangle" << endl;
- }
- else
- if (num1 != num2 && num1 != num3 && num2 != num3) {//checks if it's a scalene triangle.
- cout << "scalene triangle" << endl;
- }
- }
- else
- cout << "cannot form a triangle" << endl;
- // system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement