Answers for "01: Fizz Buzz](./03-Algorithms/01-fizz-buzz"

0

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)
  }
}
Posted by: Guest on March-20-2021
0

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)
  }
}
Posted by: Guest on March-20-2021

Browse Popular Code Answers by Language