Which of the following statements should be used to obtain a remainder after dividing 3.14 by 2.1?  

Which of the following statements should be used to obtain a remainder after dividing 3.14 by 2.1?

 

A. rem = 3.14%2.1;

B. rem = fmod(3.14, 2.1);

C. rem = modf(3.14, 2.1);

D. Remainder cannot be obtain in floating point division.

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 phần dư của phép chia 2 số nguyên. Hàm fmod() lấy phần dư của phép chia 2 số thập phân. Hàm modf() tách phần nguyên và phần thập phân.

 

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