#include <stdio.h>
int main(int argc, const char * argv[])
{
int x =10, y =20, b = 500;
int z = x*y;
int f = z/b;
// insert code here...
printf("x is:%d, y is:%d, b is %d\n",x,y,b);
printf("x times y is: %d\n",z);
printf("z divided by b is: %d\n",f);
return 0;
}
打印出f = 0。爲什麼?c中的新手和整數問題
因爲它*是* 0. – Telastyn
Int表示整數。整數點後面是否有一些數字? –