Last active
February 26, 2017 11:48
-
-
Save sekky0905/c0f755992bb951c50338f2ff00a424ad to your computer and use it in GitHub Desktop.
Go言語でFizzBuzz!を書いてみた ref: http://qiita.com/Sekky0905/items/9a5a459e143303cd0a18
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
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
i := 1 | |
for i < 101 { | |
switch { | |
case i%15 == 0: | |
fmt.Println("FIZZ BUZZ!") | |
case i%3 == 0: | |
fmt.Println("FIZZ!") | |
case i%5 == 0: | |
fmt.Println("BUZZ!") | |
default: | |
fmt.Println(i) | |
} | |
i++ | |
} | |
} |
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
1 | |
2 | |
FIZZ! | |
4 | |
BUZZ! | |
FIZZ! | |
7 | |
8 | |
FIZZ! | |
BUZZ! | |
11 | |
FIZZ! | |
13 | |
14 | |
FIZZ BUZZ! | |
16 | |
17 | |
FIZZ! | |
19 | |
BUZZ! | |
FIZZ! | |
22 | |
23 | |
FIZZ! | |
BUZZ! | |
26 | |
FIZZ! | |
28 | |
29 | |
FIZZ BUZZ! | |
31 | |
32 | |
FIZZ! | |
34 | |
BUZZ! | |
FIZZ! | |
37 | |
38 | |
FIZZ! | |
BUZZ! | |
41 | |
FIZZ! | |
43 | |
44 | |
FIZZ BUZZ! | |
46 | |
47 | |
FIZZ! | |
49 | |
BUZZ! | |
FIZZ! | |
52 | |
53 | |
FIZZ! | |
BUZZ! | |
56 | |
FIZZ! | |
58 | |
59 | |
FIZZ BUZZ! | |
61 | |
62 | |
FIZZ! | |
64 | |
BUZZ! | |
FIZZ! | |
67 | |
68 | |
FIZZ! | |
BUZZ! | |
71 | |
FIZZ! | |
73 | |
74 | |
FIZZ BUZZ! | |
76 | |
77 | |
FIZZ! | |
79 | |
BUZZ! | |
FIZZ! | |
82 | |
83 | |
FIZZ! | |
BUZZ! | |
86 | |
FIZZ! | |
88 | |
89 | |
FIZZ BUZZ! | |
91 | |
92 | |
FIZZ! | |
94 | |
BUZZ! | |
FIZZ! | |
97 | |
98 | |
FIZZ! | |
BUZZ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment