Created
February 18, 2014 05:03
-
-
Save freeonterminate/9064923 to your computer and use it in GitHub Desktop.
if 文を使わない FizzBuzz version 2
This file contains hidden or 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
program FizzBuzz; | |
uses | |
System.SysUtils; | |
var | |
i: Integer; | |
S: array [0.. 2] of String = ('', 'Fizz', 'Buzz'); | |
begin | |
for i := 1 to 100 do | |
Writeln(S[Ord(i mod 3 = 0)] + S[Ord(i mod 5 = 0) shl 1], i.ToString.Substring(0, (i mod 3) * (i mod 5) * $ff)); | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment