为什么下面的代码输出0而不是40?
#include <stdio.h>
int main()
{
int volume;
int length = 5;
int width = 8;
volume = length * width;
printf("%f", volume);
return 0;
}
最佳答案
变量“volume”是 Integer ,您需要在 printf 函数中将用于 float 变量的 %f 更改为用于 print Integer 变量的 %d 。
关于c - 为什么我的输出是 0?不应该是40吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49198720/