void main() { int i = 3; if (!i) i++; i++; if (i == 3) i += 2; i += 2; printf(“%dn”, i); getch(); } What gets printed?

void main()

{

int i = 3;

if (!i)

i++;

i++;

if (i == 3)

i += 2;

i += 2;

printf(“%dn”, i);

getch();

}

What gets printed?

A. 5

B. 6

C. 7

D. Another

Hướng dẫn

Chọn B là đáp án đúng

Xem lời giải

Xem lời giải

Vì !i = 0 nên câu lệnh i++ đầu tiên không được thực hiện, câu lệnh i++ tiếp theo được thực hiện (i = 4).

Gặp lệnh if tiếp theo không thỏa mãn, câu lệnh i+=2 thứ 2 được thực hiện.

 

Thư viện tài liệu12 Tháng bảy, 2023 @ 3:03 chiều

Đánh giá chủ đề này
How to whitelist website on AdBlocker?

How to whitelist website on AdBlocker?

  1. 1 Click on the AdBlock Plus icon on the top right corner of your browser
  2. 2 Click on "Enabled on this site" from the AdBlock Plus option
  3. 3 Refresh the page and start browsing the site