溫馨提示×

如何用c語言求三角形面積的程序

小億
91
2024-08-17 10:33:35
欄目: 編程語言

#include <stdio.h>

int main() { float base, height, area;

// Input base and height of the triangle
printf("Enter the base of the triangle: ");
scanf("%f", &base);

printf("Enter the height of the triangle: ");
scanf("%f", &height);

// Calculate the area of the triangle
area = 0.5 * base * height;

// Display the area of the triangle
printf("The area of the triangle is: %.2f\n", area);

return 0;

}

0
亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女