#include int main() { int w = 3; int x = 31; int y = 10; double z = x / y % w; printf(“%fn”, z); return 0; } What value gets printed by the program below?

#include

int main()

{

int w = 3;

int x = 31;

int y = 10;

double z = x / y % w;

printf(“%fn”, z);

return 0;

}

What value gets printed by the program below?

A. 1

B. 0

C. 0.1

Hướng dẫn

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

Xem lời giải

Xem lời giải

Toán tử / lấy thương, còn toán tử % lấy phần dư. Cả 2 toán tử này có độ ưu tiên toán tử như nhau. Do vậy, x/y%w = (x/y)%w = (31/10)%3 = 0

 

Thư viện tài liệu12 Tháng bảy, 2023 @ 3:01 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