0
Q:

ceil in c++

// C++ program to demonstrate ceil function 
#include <iostream> 
#include <cmath> 
using namespace std; 
  
// Driver function 
int main() 
{ 
    // using ceil function which return 
    // floor of input value 
    cout << " Ceil is : " << ceil(2.5) << endl; 
    cout << " Ceil is : " << ceil(-2.3) << endl; 
  
    return 0; 
} 
1
ceil(x):The ceil() function in C++ returns the smallest possible integer value which is greater
than or equal to the given argument.
Input : 2.5, -2.1, 2.9
Output : 3 , -2, 3
2
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
0

New to Communities?

Join the community