代码应该修改成这样 public class m1 { public static void main(String[] args) { long result = 0; long f; for(int i = 1 ; i = 99 ;) { result += i; i += 2; } System.out.println(result=+result); } }
public class m1 { public static void main(String[] args) { long result = 0; long f; for(int i = 1 ; i =50 ; i++) { f = 2 * i - 1; result += f; } System.out.println(result=+result); } } //试试这样吧!