How to use Pythagorean theorem in C++?
To use the Pythagorean theorem in C++, you can use the following code:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double a, b, c;
cout << "Enter the length of side a: ";
cin >> a;
cout << "Enter the length of side b: ";
cin >> b;
c = sqrt(a*a + b*b);
cout << "The length of side c is: " << c << endl;
return 0;
}