Skip to content

Create FizzBuzz2.swift#9

Open
pvgueiros wants to merge 1 commit intoCodecademy:mainfrom
pvgueiros:patch-1
Open

Create FizzBuzz2.swift#9
pvgueiros wants to merge 1 commit intoCodecademy:mainfrom
pvgueiros:patch-1

Conversation

@pvgueiros
Copy link

FizzBuzz Challenges using as few tests as possible.

FizzBuzz Challenges using as few tests as possible.
@CLAassistant
Copy link

CLAassistant commented Feb 10, 2021

CLA assistant check
All committers have signed the CLA.

@JakeK34959
Copy link

JakeK34959 commented Jun 27, 2021

// Add your code below:
var counter : Int

for counter in 0...100 {
 if counter % 3 == 0 {
   if counter % 5 == 0{
   print("fizz buzz")
   } else {
   print("fizz")
   }
 } else if counter % 5 == 0{
   print ("buzz")
 } else if counter % 3 == 0{
   
 } else {
     print (counter)
   }
}

@Buhaev-Yauhenii
Copy link

what you think about solution like this?

for i in 1...100{
(i % 3 == 0 && i % 5 == 0) ? print("FizzBuzz") : i%5 == 0 ? print("Buzz") : i%3 == 0 ? print("Fizz") : print(i)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants