题目内容
输入一个浮点数 n,输出这个浮点数的绝对值。
输入格式
输入一个浮点数 n,其绝对值不超过 10000。
输出格式
输出 n 的绝对值,保留到小数点后两位。
样例 1 输入
-3.14
样例 1 输出
3.14
程序代码输出
#include<bits/stdc++.h>
using namespace std;
int main()
{
double x;
cin>>x;
if(x>=0)
printf("%.2f",x);
else
printf("%.2f",-x);
return 0;
}