如何用c语言求三角形面积的程序

   2024-10-01 6280
核心提示:#include stdio.hint main() {float base, height, area;// Input base and height of the triangleprintf(Enter the base of th

#include <stdio.h>

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

// Input base and height of the triangleprintf("Enter the base of the triangle: ");scanf("%f", &base);printf("Enter the height of the triangle: ");scanf("%f", &height);// Calculate the area of the trianglearea = 0.5 * base * height;// Display the area of the triangleprintf("The area of the triangle is: %.2f\n", area);return 0;

}

 
举报打赏
 
更多>同类物流大全
推荐图文
推荐物流大全
点击排行

网站首页  |  关于我们  |  联系方式网站留言    |  赣ICP备2021007278号