We will learn about floor function in C programming language
In the C programming Language, the floor() function returns the nearest integer value which is less than or equal to the value for floating point argument to this function
The syntax of the floor() in the C programming Language
double floor(double x);
x is the parameter or argument of this function( x is a floating point value).
when a value for x is passed, this is returns the floor value of x, largest integer value which is less than or equal to the passed value
In the C programming Language, the required header file for floor() is
#include <math.h>
The following example explains the usage of floor() function
#include <stdio.h> #include <stdlib.h> #include <math.h> int main() { //define the variable double a=12.1,b=12.9,c=-12.1,d=-12.9; //calculate and display the floor value printf("floor value of a: %f\n",floor(a)); printf("floor value of b: %f\n",floor(b)); printf("floor value of c: %f\n",floor(c)); printf("floor value of d: %f\n",floor(d)); return 0; }
When above program is compiled and run ,it will produce the following result
floor value of a: 12.000000
floor value of a: 12.000000
floor value of a: -13.000000
floor value of a: -13.000000
Similar Functions
Other C programming language functions that are similar to the cosine function
suggested for you
User defined function in C language
C# inverted full pyramid star pattern In this article, we will discuss the concept of…
C# Full Pyramid star pattern program In this article, we will discuss the concept of…
Program to count vowels, consonants, words, characters and space in Java In this article, we…
How to print multiplication table using Array in C++ language In this post, we will…
C Program to multiplication table using Array In this tutorial , we will discuss about…
Java program to check odd or even using recursion In this tutorial, we discuss a…