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

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