<html>
<head>
<title>找出符合条件的数</title>
</head>
<body>
<h3>找出1000 ~ 9999之间能够被17和13同时整除的整数、个数、累加和</h3>
<script>
var count = 0;
var sum = 0;
for (var i = 1000; i <= 9999; i++) {
  if (i % 17 == 0 && i % 13 == 0) {
    document.write(i + " ");
    count++;
    sum += i;
    if (count % 10 == 0) {
      document.write("<br>");
    }
  }
}
document.write("<br>个数:" + count);
document.write("<br>累加和:" + sum);
</script>
</body>
</html>
编写Javascript程序找出符合条件的数。 1页面的标题是找出符合条件的数 2页面内容:3号标题显示找出1000 ~ 9999之间能够被17和13同时整除的整数、个数、累加和。 3输出格式:每行10个整数。

原文地址: https://www.cveoy.top/t/topic/cqGg 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录