1

In C++ we have the function round():

round(4.1);//=4.1
round(4.5);//=5

But what If I want to round up a given number to the nearest integer which is greater or equal to it?

1 Answers1

1

You can use the ceil() function. The ceil() function returns the ceiling of any number, or the nearest integer that is greater or equal to that number.

For example:

ceil(4.5) = 5

ceil(3) = 3

ceil(-2.5) = -2

Telescope
  • 2,068
  • 1
  • 5
  • 22