#include <math.h> double floor(double x) x : 倍精度浮動小数点数
#include <stdio.h>
#include <math.h>
int main()
{
double x;
/*
天井関数
*/
x = ceil(2.8);
printf("2.8 の ceil は %f\n", x);
x = ceil(-2.8);
printf("-2.8 の ceil は %f\n", x);
/*
床関数
*/
x = floor(2.8);
printf("2.8 の floor は %f\n", x);
x = floor(-2.8);
printf("-2.8 の floor は %f\n", x);
return 0;
}
2.8 の ceil は 3.000000 -2.8 の ceil は -2.000000 2.8 の floor は 2.000000 -2.8 の floor は -3.000000
| 菅沼ホーム | 本文目次 | 演習問題解答例 | 付録目次 | 索引 |