# Ceil Function in C

This section will discuss the Ceil function in the C programming language. Ceil function is a predefined function of math.h header file. It returns the nearest integer number, which is greater than or equal to the number passed as an argument in it. For example, we pass the float number 3.4, and the ceil() function returns the greatest number 4.

### Parameters

Here, x is an argument of the ceil function.

### Returns

The ceil() function returns the smallest possible integer value to round up the passed number x.

### Properties of the ceil function

• It is a built-in method of math.h header file.
• Using the ceil() function to return the smallest number greater than or equal to the parametric number.
• If the passed number is 0, the ceil() function returns the 0.
• If the number is equal to the mathematical integer, the result generated by the ceil() function will be the same as the specified number.
• If a number is less than 0 but greater than -1.0, the result will be zero.

### Example 1: Program to ceil a number using the ceil() function

Output

```The ceiling integer of 9.37 = 10
```

As shown in the program, the value of variable num 9.37 is passed to the ceil() function returns the round off to its nearest integer value 10.

### Example 2: Program to ceil the floating number using the ceil() function

Output

```The ceiling value of 2.30 is 3.00
The ceiling value of -2.70 is -2.00
The ceiling value of 5.10 is 6.00
The ceiling value of 56.40 is 57.00
The ceiling value of 2.80 is 3.00
```

### Example 3: Program to round up the floating number using the ceil() function

Output

```Enter the float number: 55.6
The ceil of 55.60 is 56.000000
```

### Example 4: Program to round up the positive and negative numbers using the ceil() function

Output

```Enter the positive integer: 56
Enter the negative integer: -24

The ceiling integer of 56 = 56
The ceiling integer of -24 = -24
```