Last active
October 17, 2016 07:57
-
-
Save freeonterminate/6363256 to your computer and use it in GitHub Desktop.
条件文使わない FizzBuzz
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
program FizzBuzz; | |
uses | |
System.SysUtils; | |
var | |
i: Integer; | |
Values: array [0.. 3] of String = ('', 'Fizz', 'Buzz', 'FizzBuzz'); | |
begin | |
for i := 1 to 100 do | |
begin | |
Values[0] := i.ToString; | |
Writeln(Values[Ord(i mod 3 = 0) or (Ord(i mod 5 = 0) shl 1)]); | |
end; | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment