Machine-translated by Google. Questions are authored in English.
Top

Discussion

How would you round off a value from 1.66 to 2.0?

  • A.ceil(1.66)
  • B.floor(1.66)
  • C.roundup(1.66)
  • D.roundto(1.66)

Answer: A

Correct answer: ceil(1.66)

ceil returns the smallest integer not less than its argument, so 1.66 becomes 2.0. floor would give 1.0, and neither roundup nor roundto exists in the standard library - the standard rounding function is round.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.