Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. /*
  2. * The Ludicolo Test
  3. * This is a modified version of another popular test that checks if you can
  4. * "code your way out of a wet paper bag". Basically its really simple and
  5. * I'm assigning it to see if you understood this part's concepts.
  6. *
  7. * Instructions:
  8. * Write a script that counts up from 1 to 100, including both 1 and 100 one number at a time.
  9. * As you count up, log the current number to the console. However, if the current number
  10. * is divisible by 4, print "Ludi" to the console, if the current number is divisible
  11. * by 6, log "colo" to the console, and if the current number is divisible by 4 AND 6,
  12. * log "Ludicolo" to the console. If you log one of the above strings to the console
  13. * do not log the current number to the console.
  14. *
  15. * Please turn this assignment in to me, I want to see how well you guys understood
  16. * the lesson, and I want to help you if your not doing well with it.
  17. *
  18. * HINT: Remember DRY (Don't Repeat Yourself).
  19. * HINT: Day 2 introduced a JavaScript math operator that can tell you if a number is divisible by another number.
  20. *
  21. * When submitting fill this out (only discord tag is required):
  22. * Discord Tag: Anubis#2855
  23. * Pokemon Showdown Username: Anubis
  24. * Twitch Username: tverbloem
  25. */
  26. 'use strict';
  27.  
  28. for (let n = 1; n <= 100; n++) {
  29. if (n % 4 === 0) {
  30. if (n % 6 === 0)
  31. console.log(`Ludicolo`);
  32. else
  33. console.log(`Ludi`);
  34. } else if (n % 6 === 0)
  35. console.log(`colo`);
  36. else
  37. console.log(n);
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement