FizzBuzz

var checkNum: Int = 1

while checkNum < 101 {
let by3 = checkNum % 3
let by5 = checkNum % 5
let fizzBuzz = (by3, by5)
switch fizzBuzz {
case (0, 0):
print(“FizzBuzz \(checkNum)”)
case (_, 0):
print(“Buzz \(checkNum)”)
case (0, _):
print(“Fizz \(checkNum)”)
default:
print(checkNum)
}

checkNum += 1

By DuaneGallaher

Musician, bicycle mechanic, eBike enthusiast, former mainframe developer becoming web developer, all around curious person with passion for solving problems.

Leave a Reply