<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Sum of Odd/Even</title> </head> <body> <script type="text/javascript"> var sumSeven = 0; var count = 0; var i; for(i=1; i<=100; i++) { if(i%7 == 0) { sumSeven += i; count++; } } document.write("The sum of seven during 1~100 is "+sumSeven+"<br />"); document.write("Count "+count+"<br />"); </script> </body> </html>
原文:https://www.cnblogs.com/tianxiaxuange/p/9678170.html