**输入格式要求:"%f" 提示信息:"Input a float number:"
**输出格式要求:"Absolute value of x is %.2fn"
程序运行示例如下:
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 %.2fn", num);
}
else
{
printf("Absolute value of x is %.2fn", -num);
}
return 0;
}
最后
以上就是腼腆海燕最近收集整理的关于从键盘任意输入一个实数,不使用计算绝对值函数编程计算并输出该实数的绝对值。的全部内容,更多相关从键盘任意输入一个实数,不使用计算绝对值函数编程计算并输出该实数内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复