Tuesday, June 11, 2024

๐ŸŽ‰ I just finished Day 6 of the #100DaysOfSwiftUI at https://www.hackingwithswift.com/100/swiftui/6

/* FIZZ BUZZ


 

 Your goal is to loop from 1 through 100, and for each number:


 If it’s a multiple of 3, print “Fizz”

 If it’s a multiple of 5, print “Buzz”

 If it’s a multiple of 3 and 5, print “FizzBuzz”

 Otherwise, just print the number.

 

 */


import UIKit


let fizz = 3

let buzz = 5


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)

    }

} 

No comments:

Post a Comment

๐ŸŽ‰ I just finished Day 19 of the #100DaysOfSwiftUI at https://www.hackingwithswift.com/100/swiftui/19

 Made a Temperature Converter App for the SwiftUI Challenge Day!