JavaScript is required

Khi bạn thực thi đoạn mã C sau, kết quả sẽ như thế nào?

A.

A.-6

B.

B.5

C.

C.4

D.

Một cái khác

Trả lời:

Đáp án đúng: A


The code calculates the result of a float division and then casts it to an integer. a is 5 and b is 2. (float)a/b results in 2.5. Then, this is cast to an integer, so d becomes 2. Thus, the program prints 2.

Câu hỏi liên quan