Created
June 10, 2014 05:27
-
-
Save yelinaung/ae19e4ec6f05c2aa54e5 to your computer and use it in GitHub Desktop.
Simple FizzBuzz in Swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.swift | |
// SwiftTest | |
// | |
// Created by Ye Lin Aung on ၁၄/၀၆/၁၀. | |
// Copyright (c) ၂၀၁၄ Ye Lin Aung. All rights reserved. | |
// | |
import Foundation | |
var a = 1...100 | |
for b in a { | |
if b % 15 == 0 { | |
println("fizzbuzz") | |
} else if b % 3 == 0 { | |
println("fizz") | |
} else if b % 5 == 0 { | |
println("buzz") | |
} else { | |
println(b) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment