<!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>
原文:http://www.cnblogs.com/popodashijian/p/5988524.html