#include "stdio.h"
int main()
{
float height,t,a;
scanf("%f%f",&a,&t);
height=1/2*a*t*t;
if(height>=100)
printf("100");
else
printf("%.2f",height);
return 0;
}
只要改一点点就可以了
height=1.0/2*a*t*t;//整数除整数结果也会是一个整数
scanf("%f%f",&a,&t);
中间打个空格或者符号,输入的时候也相应打个空格
scanf("%f %f",&a,&t);
改了,输出一直是零啊
请大佬给出题目
撤回一下,height=1/2*a*t*t;这句里,1/2的int类是0,所以就会一直是0,应该改成height=1.0/2*a*t*t;