eclipse运行正确 pta提交0分 哪有错???
package demo2;
import java.util.Scanner;
import java.lang.Math;
/*
输入一个整数,输出各位数字之和[
*/
public class test1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int x = 0 , y = 0,sum = 0;
Scanner scanner = new Scanner(System.in);
x = scanner.nextInt();
while (x!=0) {
if (x>0) {
sum+=x%10;
x=x/10;
}
else {
y=(Math.abs(x));
sum+=y%10;
y=y/10;
x=y;
}
}
System.out.println(sum);
}
}