1 /* 2 Name:1-100所有奇数求和的程序 3 Power by Stuart 4 Date:2015-4-23 5 */ 6 7 8 public class DateTest01{ 9 10 public static void main(String args[]){ 11 //for循环,每次循环间隔2次 12 for(int i=1;i<=100;i+=2){ 13 t+=i;//t=i+1; 14 } 15 System.out.println("从1到100的奇数为"+t); 16 } 17 18 }