Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function numbersDivisibleBy9(input) {
- let start = Number(input[0]);
- let end = Number(input[1]);
- let sum = 0;
- let printNum = "";
- for (let index = start; index <= end; index++) {
- if (index % 9 === 0) {
- sum += index;
- printNum += `${index}\n`;
- }
- }
- console.log(`The sum: ${sum}`);
- console.log(printNum);
- }
- numbersDivisibleBy9(["100", "200"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement