Advertisement
DraconiusNX

Untitled

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