math.floor in c++ code example

Example 1: 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

Example 2: floor in c++

floor(x):This function in C++ returns the largest possible integer value which is smaller
than or equal to the given argument.
Input : 2.5 ,-2.1 ,2.9
Output : 2 ,-3, 2

Example 3: floor() in c++

floor(x):This function in C++ returns the smallest possible integer value which is smaller
 than or equal to the given argument.
Input : 2.5 ,-2.1 ,2.9
Output : 2 ,-3, 2

Tags:

Cpp Example