以下是引用神vLinux飘飘在2005-2-1 23:50:25的发言:
main(){int a,b;scanf("%d,%d",&a,&b);printf("%d",(b>0)?a+b:a-b);}
输入15,-2
输出17
main(a,b){printf("%d",b>0?a+b:a-b,scanf("%d,%d",&a,&b));} ----------------解决方案--------------------------------------------------------
#include "math.h"
main()
{int a,b,sum;
scanf("%d%d",&a,&b);
sum=a+fabs(b);
printf("%d",sum);
}
这样一定行的通~
----------------解决方案--------------------------------------------------------
严重同意~!!
----------------解决方案--------------------------------------------------------
#include"stdio.h"
#include"math.h"
main()
{ int a,b,c=0;
printf("Please input the value of a and b\n");
scanf("%d%d",&a,&b);
c=a+fabs(b);
printf("%d",c);
}
----------------解决方案--------------------------------------------------------
b的绝对值哦
是那样子的吗
----------------解决方案--------------------------------------------------------
绝对值函数名是不是应该改成
int abs(int b)
----------------解决方案--------------------------------------------------------