**输入格式要求:"%f" 提示信息:"Input a float number:"
**输出格式要求:"Absolute value of x is %.2f\n"
程序运行示例如下:
Input a float number:-2.3
Absolute value of x is 2.30
#include<stdio.h>
int main()
{
float num;
printf("Input a float number:");
scanf_s("%f", &num);
if (num >= 0)
{
printf("Absolute value of x is %.2f\n", num);
}
else
{
printf("Absolute value of x is %.2f\n", -num);
}
return 0;
}