c#编写1-2+3-4……m
static void Main(string[] args) { int j; int m = 9; for (int i = 1; i < m; i++) { j = sum(i); if (j > 0 && j != 1) Console.Write("+"); Console.Write(j); } Console.ReadLine(); } public static int sum(int shu) { int hee = 0; if (shu % 2 == 0) { hee -= shu; } else { hee += shu; } return hee; }