Liliana797979

division - fundamentals

Mar 16th, 2021
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function division(num){
  2.  
  3.     let div = [10,7,6,3,2];
  4.  
  5.     for (i = 0; i <= 5; i++) {
  6.  
  7.         let a = div.shift();
  8.  
  9.         if (num % a === 0) {
  10.  
  11.            
  12.  
  13.             console.log(`The number is divisible by ${a}`);
  14.  
  15.             break;
  16.  
  17.         } else if (i === 5) {
  18.  
  19.             console.log(`Not divisible`)
  20.  
  21.         }
  22.  
  23.     }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment