<?php //1-100之间能被3整除的数字之和; $n =1; $sum = 0; $m = 0; while($n<=100){ if($n % 3 == 0) { // echo $n.'<br>';//每个数都循环出来 $sum += $n; } $n++; } echo $sum; ?>
<?php //1-100之间能被3整除的数字之和; $n =1; $sum = 0; $m = 0; while($n<=100){ if($n % 3 == 0) { // echo $n.'<br>';//每个数都循环出来 $sum += $n; } $n++; } echo $sum; ?>