编写计算等腰三角形高(Altitude)的程序

5 Sept 2024 | 2 分钟阅读

在用不同编程语言编写计算等腰三角形高的程序之前,我们首先需要了解等腰三角形高的计算公式?

用不同编程语言计算等腰三角形高的程序

程序 1:用 C 语言编写程序

以上 C 程序的输出

Enter the side a of the Isosceles Triangle:5
Enter the base b of the Isosceles Triangle:8
Altitude of the Isosceles Triangle is: 3.00

程序 2:用 Java 语言编写程序

以上 Java 程序的输出

The Altitude of a Isosceles Triangle in Java:
3.0

程序 3:用 PHP 编程语言编写程序。

以上 PHP 程序的输出

3

程序 4:用 Python 编程语言编写程序。

以上 Python 程序的输出

3.0