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