Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create FizzBuzz2.swift #9

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

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