User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







c:math.h:floor

Table of Contents

floor

    double floor(double);

rounding down a number

C Sourcecode Example

compile in linux with: gcc floor.c -o floor -lm -Wall

#include <stdio.h> /* including standard library */
//#include <windows.h> /* uncomment this for Windows */
 
#include <math.h> /* including math library */
 
int main ( void ) 
{
double y,x;
x = 4.2;
y = 9.9;
printf("floor of %f is %f\n", x, floor(x) );
printf("floor of %f is %f\n ",y , floor(y) );
return 0;
}

output

 output:
 user@host:~$ ./floor 
 floor of 4.200000 is 4.000000
 floor of 9.900000 is 9.000000

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
c/math.h/floor.txt · Last modified: 2024/02/16 01:05 (external edit)

Impressum Datenschutz