Advertisement
Liliana797979

viarno reshenie numbers divisible by 9

Feb 8th, 2021
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         function numbersDivibleBy9(input) {
  2.             let start = Number(input[0]);
  3.             let end = Number(input[1]);
  4.          
  5.             let sum = 0;
  6.             for (let i = start; i <= end; i++) {
  7.                 if (i % 9 === 0) {
  8.                     sum += i;
  9.                 }
  10.             }
  11.             console.log(`The sum: ${sum}`);
  12.             for (let j = start; j <= end; j++) {
  13.                 if (j % 9 === 0) {
  14.                     console.log(j);
  15.                 }
  16.             }
  17.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement