操场上100多人( >=101 <=199)排队,三人一组多1人,四人一组多2人,五人一组多3人,共多少人?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<button type="button" value="求和" οnclick="calc()">分组问题</button>
<div id="pd">
</div>
<script>
function calc() {
// let i = 101;
let str = '';
// while (i <= 199) {//循环条件
// if(i % 3 == 1 && i % 4 == 2 && i % 5 == 3) {//
// str+=i+' ';
// console.log(str);
// }
// i++;
// }
for (let i = 101; i < 199; i++) {
if (i % 3 == 1 && i % 4 == 2 && i % 5 == 3) { //
str += i + ' ';
console.log(str);
}
}
document.getElementById("pd").innerHTML = str;
}
</script>
</body>
</html>