Popular Tutorials
Start Learning CCertification Courses
Created with over a decade of experience and thousands of feedback.
Python online compiler
JavaScript online compiler
SQL online compiler
Java online compiler
HTML online compiler
C online compiler
C++ online compiler
C# online compiler
PHP online compiler
Swift online compiler
Kotlin online compiler
TypeScript online compiler
Go online compiler
Rust online compiler
Scala online compiler
Dart online compiler
R online compiler
Ruby online compiler
C ceil()
The ceil() function computes the nearest integer greater than the argument passed.
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?