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

avatar
作者
筋斗云
阅读量:0

#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; 

}

广告一刻

为您即时展示最新活动产品广告消息,让您随时掌握产品活动新动态!