#include<stdio.h>
#include<stdlib.h>
int main()
{
int numb,r;
int abs;
printf("请输入整数的值:");
r=scanf_s("%d", &numb);
if (r == 1) {
if (numb > 0) {
abs = numb;
}
else
{
abs = -numb;
}
printf("numb的绝对值是:%d\n", abs);
}
else
{
printf("输入错误!");
}
return 0;
}
求整数的绝对值
最新推荐文章于 2022-08-20 15:10:03 发布