Створіть функцію на с++, яка обчислить гипотенузу прямокутного трикутника

Ответы

Ответ дал: asilvejstruk
1

#include <iostream>

#include <math.h>

using namespace std;

void Pythagoras(double a, double b) {

    double res = sqrt(a * a + b * b);

    cout << res;

}

int main() {

   double a, b;

   cout << "Enter a, b";

   cin >> a >> b;

   Pythagoras(a, b);

   return 0;

}

Ответ дал: alexanderlox
0

#include <iostream>

#include <cmath>

using namespace std;

double Pythagoras(double a, double b) {

   double res = sqrt(a * a + b * b);

   return res;

}

int main() {

  double a, b;

  cout << "Enter a, b";

  cin >> a >> b;

  cout << Pythagoras(a, b);

  return 0;

}

Вас заинтересует