-
Notifications
You must be signed in to change notification settings - Fork 2
fizzbuzz
bradendubois edited this page Jun 9, 2021
·
7 revisions
ID: fizzbuzz
Difficulty: 1.3
CPU Time: 1 second
Memory: 1024 MB
This one is pretty straightforward; loop through each number i from 1 to N, and we can consider the message to be printed to be an empty string, or something placeholder, and we can add "Fizz" if i % X == 0, and add "Buzz" if i % Y == 0, and if the string is no longer empty, print it, otherwise we just print i since it's not divisible by either X or Y.