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      

cosh function   in C  language                               

sinh function in C language

tanh function in C language

abs function in C language

floor function in C language

round function in C language

sqrt function in C language

pow function in C language

exp function in C language

log function in C language

log10 function in C language

trunc function in C language

 

 

suggested for you

Function in C language

User defined function in C language

Arithmetic functions in C Language

String function in C language

floor function in C programming language
round function in C programming language
Karmehavannan

I am Mr S.Karmehavannan. Founder and CEO of this website. This website specially designed for the programming learners and very especially programming beginners, this website will gradually lead the learners to develop their programming skill.

Recent Posts

How to find reverse number using method in Java

How to find reverse number using method In this article, we will discuss the concept…

2 days ago

C# inverted full pyramid star pattern

C# inverted full pyramid star pattern In this article, we will discuss the concept of…

3 weeks ago

C# Full Pyramid star pattern program

C# Full Pyramid star pattern program In this article, we will discuss the concept of…

1 month ago

Program to count vowels,consonants,words, characters and space in Java

Program to count vowels, consonants, words, characters and space in Java In this article, we…

1 month ago

How to print multiplication table using Array in C++ language

How to print multiplication table using Array in C++ language In this post, we will…

1 month ago

C Program to multiplication table using Array

C Program to multiplication table using Array In this tutorial , we will discuss about…

2 months ago