<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>倍数处理</title>
</head>
<body>
</body>
<script type="text/javascript">
var sum = 0;
var a = 0
for(i = 1; i <= 99; i++) {
//i是3的倍数时
if(i % 3 == 0) {
sum += i
a = a + i
document.write(sum + "<br />")
document.write(a)
}
}
</script>
</html>
时间: 2024-10-06 05:23:20