Skip to content

Instantly share code, notes, and snippets.

@melcu
Created October 12, 2017 03:05
Show Gist options
  • Save melcu/60ae201522b4fd9937ff8305178a65ea to your computer and use it in GitHub Desktop.
Save melcu/60ae201522b4fd9937ff8305178a65ea to your computer and use it in GitHub Desktop.
Fizz Buzz Algorithm Swift 4
var oneK = [Int]()
for i in 1...100{oneK.append(i)}
for num in oneK {
if num % 15 == 0 { print("\(num) FizzBuzzz") }
else if num % 3 == 0 { print("\(num) Fizz") }
else if num % 5 == 0 { print("\(num) BuzZZZzzz") }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment