fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. double a, b, c;
  6.  
  7. cout << "enter side a: ";
  8. cin >> a;
  9.  
  10. cout << "enter side b: ";
  11. cin >> b;
  12.  
  13. cout << "enter side c: ";
  14. cin >> c;
  15.  
  16. if (a > 0 && b > 0 && c > 0) {
  17. if (a*a == b*b + c*c ||
  18. b*b == a*a + c*c ||
  19. c*c == a*a + b*b) {
  20.  
  21.  
  22. cout << "this is a right triangle.\n";
  23. }
  24. else {
  25. cout << "this is NOT a right triangle.\n";
  26. }
  27. }
  28. else {
  29. cout << "all sides must be positive!\n";
  30. }
  31.  
  32. return 0;
  33. }
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
enter side a: enter side b: enter side c: this is a right triangle.