求绝对值 | |||
| |||
description | |||
求实数的绝对值。 | |||
input | |||
输入数据有多组,每组占一行,每行包含一个实数。 | |||
output | |||
对于每组输入数据,输出它的绝对值,要求每组数据输出一行,结果保留两位小数。 | |||
sample_input | |||
123-234.00 | |||
sample_output | |||
123.00234.00 | |||
hint | |||
source | |||
hdu |
#include#include #include int main(){ double a; while(scanf("%lf",&a)!=-1) { printf("%.2lf\n",fabs((double)a)); } return 0;}
新函数!!注意头文件!!
int abs(int i); 求整型的绝对值
double fabs (double);求实型的绝对值