public class QiuZhi1 public static void main(String[] args) int sum = 0; int num = 0; int a = 1; for(int i = 13 ; i <= 1003 ; i += 10) if(num%2 == 0) a = 1; //当num为偶数时,a的值为1 }else a = -1; } sum = sum + i*a; num ++; } System.out.println("13-23+23-33+43+...+973-983+993-1003的值为: " + sum); }}