var scount1=0; var scount2=0; var ssum1=0; var ssum2=0; var i =1; while (i<=100){ if(i%2==0){ scount2 +=1; ssum2 +=i; }else{ scount1 +=1; ssum1 += i; } i++; } document.write ("奇数的个数是:"+scount1+"
"); document.write("所有奇数之和为:"+ssum1+"
"); document.write ("偶数的个数是:"+scount2+"
"); document.write("所有偶数之和为:"+ssum2+"
");