Answers for "fizzbuzz swift switch"

1

fizbuzz in swift

func fizzBuzz() {
    for i in 1...100
    {
        if i % 3 == 0 && i % 5 == 0
        {
            print("FizzBuzz")
        } else if i % 3 == 0
        {
            print("Fizz")
        } else if i % 5 == 0
        {
            print("Buzz")
        } else
        {
            print(i)
        }
    }
}
Posted by: Guest on June-25-2020

Code answers related to "Swift"

Browse Popular Code Answers by Language