01: Fizz Buzz](./03-Algorithms/01-fizz-buzz code example

Example 1: 01: Fizz Buzz](./03-Algorithms/01-fizz-buzz

for num in number {
  if num % 15 == 0 {
    print("\(num) fizz buzz")
  } else if num % 3 == 0 {
    print("\(num) fizz")
  } else if num % 5 == 0 {
    print("\(num) buzz")
  } else {
    print(num)
  }
}

Example 2: 01: Fizz Buzz](./03-Algorithms/01-fizz-buzz

for num in number {
  if num % 3 == 0 && num % 5 == 0 {
    print("\(num) fizz buzz")
  } else if num % 3 == 0 {
    print("\(num) fizz")
  } else if num % 5 == 0 {
    print("\(num) buzz")
  } else {
    print(num)
  }
}

Tags:

Cpp Example