400 Câu hỏi trắc nghiệm lập trình C/C++ có đáp án (Phần 2)

We want to round off x, a float, to an int value, The correct way to do is

31/50

We want to round off x, a float, to an int value, The correct way to do is:

y = (int)(x + 0.5)

y = int(x + 0.5)

y = (int)x + 0.5

y = (int)((int)x + 0.5)

Giải thích

Chọn A