#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
#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: 5Enter the length of one cathetus: 3
The length of the second cathetus is: 4
The radius of the inscribed circle is: 1