var num = 1; var num1 = 1; var oddSum = 0; var evenSum = 0; var timesSum = 0; while(num <= 100){ if (num % 2 == 0) { evenSum = evenSum + num; }else if (num % 2 == 1) { oddSum = oddSum + num; } num++; } while (num1 <= 100){ if (num1 % 3 == 0) { timesSum = timesSum + num1; } num1++; } console.log("偶数" + evenSum,"奇数" + oddSum,"3的倍数" + timesSum)