CIT program 2002 past paper MC No. 41

2008-04-16 6:36 am
41.
#include <stdio.h>
#include <math.h>

int main()
{
int x, y, z;

x = abs(-10.5);
y = 11 % 4;
z = x / 6 * y;
printf("%d\n", z);
}


A.-2
B.1
C.2
D.3

ANSWER: D.

點介Z係3?
Z唔係等於 11/6*3=5.5 ??????

回答 (1)

2008-04-16 6:53 am
✔ 最佳答案
先要記住...x,y,z 都是integer type... 姐係冇小數位

x = abs(-10.5); //x = 10
y = 11 % 4; // y= 3
z = x / 6 * y; //z = 10 /6 *3
//z = 1*3 = 3

明冇?



收錄日期: 2021-04-19 00:58:14
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20080415000051KK02940

檢視 Wayback Machine 備份