A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

Write a C++ program to check whether given length of three side form a right triangle
Q:

Write a C++ program to check whether given length of three side form a right triangle

0

Write a C++ program to check whether given length of three side form a right triangle

Sample Output:

Sample input : 6 9 7
Sample Output:
No

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
  
    vector<int> triangle_sides(3);

        cin >> triangle_sides[0] >> triangle_sides[1] >> triangle_sides[2];

        sort(triangle_sides.begin(), triangle_sides.end());

        if (triangle_sides[0]*triangle_sides[0] + triangle_sides[1]*triangle_sides[1] == triangle_sides[2]*triangle_sides[2]) 
        {
            cout << "Yes" << endl; 
        }
        else 
        {
            cout << "No" << endl;
        }
 
    return 0;
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now