C ceil()

C ceil() Prototype

double ceil( double arg );

The ceil() function takes a single argument and returns the nearest integer number.

For example: If 2.3 is passed to ceil(), it will return 3.


The function is defined in <math.h> header file.

long double ceill( long double arg );
float ceilf( float arg );

In order to find the ceil() of long double or float, you can use the above prototype.


Example: C ceil() function

#include <stdio.h>
#include <math.h>

int main()
{
   double num = 8.33;
   int result;

   result = ceil(num);
   printf("Ceiling integer of %.2f = %d", num, result);

   return 0;
}

Output

Ceiling integer of 8.33 = 9
Did you find this article helpful?

Our premium learning platform, created with over a decade of experience and thousands of feedbacks.

Learn and improve your coding skills like never before.

Try Programiz PRO
  • Interactive Courses
  • Certificates
  • AI Help
  • 2000+ Challenges