根据用户输入的,上底,下底 ,高计算梯形的面积
//根据用户输入的上底,下底和高计算梯形的面积。 //面积=(上底+下底)*高/2; float top,bottom,height,s; printf("请输入梯形的上底:\n"); scanf("%f",&top); printf("请输入梯形的下底:\n"); scanf("%f",&bottom); printf("请输入梯形的高:\n"); scanf("%f",&height); s=(top+bottom)*height/2;//计算面积 printf("梯形的面积为:%0.2f",s);

浙公网安备 33010602011771号