double floor(double x);
Parameter:
X: tham số đầu vào double
Remark:
Hàm floor( ) trả về giá trị lớn nhất và nhỏ hơn hoặc bằng x.
Ví dụ:
#include <math.h> #include <conio.h> #include <stdio.h> void main( void ) { double y; y = floor( 2.8 ); printf( "The floor of 2.8 is %f\n", y ); y = floor( -2.8 ); printf( "The floor of -2.8 is %f\n", y ); y = ceil( 2.8 ); printf( "The ceil of 2.8 is %f\n", y ); y = ceil( -2.8 ); printf( "The ceil of -2.8 is %f\n", y ); getch(); }
Kết quả:
Leave a Reply
You must be logged in to post a comment.