15. Даны гипотенуза и катет прямоугольного треугольника. Найти второй катет и радиус вписанной окружности. Решить на C++.

5 Окт 2019 в 19:43
311 +1
0
Ответы
1
#include <iostream>
#include <cmath>
int main() {
double hypotenuse, cathetus1;
std::cout << "Enter the length of the hypotenuse: ";
std::cin >> hypotenuse;
std::cout << "Enter the length of one cathetus: ";
std::cin >> cathetus1;
double cathetus2 = sqrt(pow(hypotenuse, 2) - pow(cathetus1, 2));
double radius = (cathetus1 + cathetus2 - hypotenuse) / 2;
std::cout << "The length of the second cathetus is: " << cathetus2 << std::endl;
std::cout << "The radius of the inscribed circle is: " << radius << std::endl;
return 0;
}

Пример работы программы:

Enter the length of the hypotenuse: 5
Enter the length of one cathetus: 3
The length of the second cathetus is: 4
The radius of the inscribed circle is: 1
19 Апр 2024 в 14:09
Не можешь разобраться в этой теме?
Обратись за помощью к экспертам
Гарантированные бесплатные доработки в течение 1 года
Быстрое выполнение от 2 часов
Проверка работы на плагиат
Поможем написать учебную работу
Прямой эфир