vikkktor

Basic Syntax_03.division

Sep 20th, 2021 (edited)
806
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(input) {
  2.  
  3.     let number = input;
  4.  
  5.     if (number % 10 === 0) {
  6.         console.log("The number is divisible by 10")
  7.     } else if (number % 7 === 0) {
  8.         console.log("The number is divisible by 7")
  9.     } else if (number % 6 === 0) {
  10.         console.log("The number is divisible by 6")
  11.     } else if (number % 3 === 0) {
  12.         console.log("The number is divisible by 3")
  13.     } else if (number % 2 === 0) {
  14.         console.log("The number is divisible by 2")
  15.     } else {
  16.         console.log("Not divisible")
  17.     }
  18.  
  19. }
  20.  
  21. solve(30)
  22. solve(15)
  23. solve(12)
  24. solve(1643)
RAW Paste Data