Right Click to Search

Thursday, July 29, 2024

Ceil Function >> Round Up Value >> Math.h >> Header File in C


Ceil Function :
  1. Ceil() is also Called as "Round Up
  2. floorl Function Evaluates "floorl finds the Smallest (long double) integer not Less than x."
  3. Ceil() Returns the Smallest integral value that is not Less than x.
  4. Suppose num = 12.1 then ceil(num) Returns 13
  5. Header File : Math.h 
Syntax :
double ceil (double x);
float ceil (float x);
long double ceil (long double x);
Live Example :
/* floor example */
#include<stdio.h>
#include<math.h>
int main ()
{
  printf ("ceil of  4.5 is %f\n", ceil(4.5));
  printf ("ceil of  6.1 is %f\n", ceil(6.1));
  printf ("ceil of -2.3 is %f\n", ceil(-2.3));
  printf ("ceil of -3.8 is %f\n", ceil(-3.8));
  return 0;
}
Output :
floor of  4.5 is 5
floor of  6.1 is 7
floor of -2.3 is -2
floor of -3.8 is -3
Negative Parameter ???
  1. As we Move Towards Positive Direction , we can conclude that -
5 > 4 > 3 > 2 > 1
  1. So ceil(3.2) Returns ==> 4
  2. As we Move Towards Negative Direction , we can conclude that -
-1 > -2 > -3 > -4 > -5
  1. So ceil(-3.2) Returns ==> -3

Tags / Keywords : | , , , ,

Stumble
Delicious
Technorati
Twitter
Facebook

0 Comments:

Post a Comment

Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email

 

Learn C Programming Copyright © 2010 LKart Theme is Designed by Lasantha, Free Blogger Templates