是这个意思不
#include <stdio.h>
int main()
{
int x;
scanf("%d", &x);
if(x >= 0)
{
printf("%d\n", x);
}
else
{
printf("%d\n", -x);
}
}
没看明白你痛苦在什么地方?????
#include <stdio.h>
#include <math.h>
int main ()
{
float a;
printf("输入:");
scanf("%f",&a);
if (a<0)
{
a=-a;
}
printf("Absolute value of x is %f\n",a);
}
卡的刚好是什么意思?让你写你的代码块,并不是让你只能写13-17 三行吧,你在begin end之间写代码就行了呀
abs()求绝对值的C语言库函数,去了解一就OK了