写一个for就能写完了...先定义一下:intsum1=0;intsum2=0;偶数的:for(i=0;i<=100;i+=2){sum1+=i;System.out.println("nownumber:"+i+",sum1="+sum1);}奇数的:for(j=1;j<=100;j+=2){sum2+=j;System.out.println("nownumber:"+ j+",sum2="+sum2);}