ceil vs floor code example
Example 1: what is difference between ciel and floor
Ceil (short for ceiling) and floor function are both mathematical
functions. ... For example, ceil function returns the least value
of the integer that is greater than or equal to the specified number.
On the other hand, floor function gets the greatest value that is
less than or equal to the specified number.
Example 2: ceil and floor
Examples of Floor:
=====================
Input : 2.5
Output : 2
Input : -2.1
Output : -3
Input : 2.9
Output : 2
===============================
Examples of Ceil:
=====================
Input : 2.5
Output : 3
Input : -2.1
Output : -2
Input : 2.9
Output : 3