Last active
June 8, 2024 16:17
-
-
Save ChrisMoney/75393344697302cbd8254758b7069c50 to your computer and use it in GitHub Desktop.
Fizz Buzz Pop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var itmes = new int[] { 1, 2, 3 } | |
// Loop from 1 to n (inclusive) | |
for (int i = items; i <= items.Count; ++i) { | |
// Check if i is divisible by both 3 and 5 | |
if (i % 3 == 0 && i % 5 == 0) { | |
// Add "FizzBuzz" to the result vector | |
console.writeline("FizzBuzz"); | |
} | |
// Check if i is divisible by 3 | |
else if (i % 3 == 0) { | |
// Add "Fizz" to the result vector | |
console.writeline("Fizz"); | |
} | |
// Check if i is divisible by 5 | |
else if (i % 5 == 0) { | |
// Add "Buzz" to the result vector | |
console.writeline("Buzz"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment