ceil function in C programming language
- Home
- pre-define maths function in C
- ceil function in C programming language
- On
- By
- 0 Comment
- Categories: pre-define maths function in C
ceil function in C programming language
ceil function in C programming language
In this tutorial, we will learn about ceil function in C programming language
In the C Programming Language, the ceil() returns the nearest integer value which is greater than or equal to the value of floating point passed value.
Declaration
Syntax
The syntax of the ceil() function in the C programming Language
double ceil(double x);
parameters or Argument
x is the parameter or argument of this , x is a floating point value.
Return value
when the value for x is passed, this is returns the ceil value of x
Required Header
In the C Language, the required header file for ceil() function is
#
include <math.h>
ceil function in C
Example
program
The following example explains the usage of ceil() function
//Example for ceil math function in C language #include <stdio.h> #include <stdlib.h> #include <math.h> int main() { //Define temporary variables double a=12.1,b=12.9,c=-12.1,d=-12.9; //Calculate and display ceil value for given value printf("ceil value of a: %f\n",ceil(a)); printf("ceil value of b: %f\n",ceil(b)); printf("ceil value of c: %f\n",ceil(c)); printf("ceil value of d: %f\n",ceil(d)); return 0; }
When the above program is compiled and run, it will produce the following result
ceil value of a: 13.000000
ceil value of a: 13.000000
ceil value of a: -12.000000
ceil value of a: -12.000000
Similar Functions
Other C programming language functions that are similar to the cosine function
suggested for you
User defined function in C language