September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -1,86 +0,0 @@
FIZZBUZZ CSECT A SECTION OF CODE STARTS HERE, LABEL IT FIZZBUZZ
**********HOUSE KEEPING AREA**********************
USING *,12 FOR THIS PROGRAM WE ARE GOING TO USE REGISTER 12
STM 14,12,12(13) SAVE REGISTERS 14,15, AND 0-12 IN CALLER'S SAVE AREA
LR 12,15 PUT OUR ENTRY ADDRESS(IN R15) INTO OUR BASE REGISTER
LA 15,SAVE POINT R15 AT THE *OUR* SAVE AREA (DEFINED AT THE END)
ST 15,8(13) SET FORWARD CHAIN
ST 13,4(15) SET BACKWARD CHAIN
LR 13,15 SET R13 TO THE ADDRESS OF OUT NEW SAVE AREA
**********MAIN*PROGRAM****************************
LA 10,LOOP PUT THE LOOP START ADDRESS IN R10
LA 8,100 PUT THE NUMBER OF ITERATIONS IN R8
LA 5,=F'1' INITIALIZE BINARY COUNTER TO ONE
LOOP EQU * LABEL THE LOOP START
A 5,=F'1' ADD TO BINARY LOOP COUNTER
AP NUM,=PL1'1' ADD TO PACKED LOOP COUNTER
B CHK15 CHECK IF COUNTER IS % 12
LCHK15 EQU * IF NOT, COME BACK
B CHK3 CHECK IF COUNTER IS % 3
LCHK3 EQU * IF NOT, COME BACK
B CHK5 CHECK IF COUNTER IS % 4
LCHK5 EQU * IF NOT, COME BACK
MVC EOUT,EMSK PREPARE TO PKD->EBCDIC
EDMK EOUT,NUM PKD->EBCDIC
ENLOOP EQU * IF A TEST WAS POSITIVE RETURN HERE
WTO MF=(E,WTOSTART) PRINT RESULT OF LOOP
BCTR 8,10 START OVER
**********HOUSE KEEPING AREA**********************
L 13,4(13) RESTORE ADDRESS TO CALLER'S SAVE AREA
LM 14,12,12(13) RESTORE REGISTERS AS ON ENTRY
XR 15,15 XOR R15 SO IT IS ALL 0 (R15 CREATES THE PROGRAM RETURN CODE)
BR 14 RETURN WHERE YOU CAME FROM
**********SUBROUTINE AREA*************************
*////////CHK3////////////////////////////////////*
CHK3 EQU * LABEL ENTRY POINT
LR 6,5 LOAD R6 WITH R5(THE BINARY LOOP INDEX)
A 6,=F'1' ADD ONE TO R6
SRDA 6,32 SHIFT RD VAL 32 BITS RIGHT(TO R7)
D 6,=F'3' DIVIDE BY 3
C 6,=F'0' IS REMAINDER 0?
BE DIV3 IF SO GOTO DIV3 ROUTINE
B LCHK3 IF NOT GO BACK TO LOOP
*////////CHK15///////////////////////////////////*
CHK15 EQU * LABEL ENTRY POINT
LR 6,5 LOAD R6 WITH R5(THE BINARY LOOP INDEX)
A 6,=F'1' ADD ONE TO R6
SRDA 6,32 SHIFT RD VAL 32 BITS RIGHT(TO R7)
D 6,=F'15' DIVIDE BY 15
C 6,=F'0' IS REMAINDER 0?
BE DIV15 IF SO GOTO DIV15 ROUTINE
B LCHK15 IF NOT GO BACK TO LOOP
*////////CHK5////////////////////////////////////*
CHK5 EQU * LABEL ENTRY POINT
LR 6,5 LOAD R6 WITH R5(THE BINARY LOOP INDEX)
A 6,=F'1' ADD ONE TO R6
SRDA 6,32 SHIFT RD VAL 32 BITS RIGHT(TO R7)
D 6,=F'5' DIVIDE BY 5
C 6,=F'0' IS REMAINDER 0?
BE DIV5 IF SO GOTO DIV5 ROUTINE
B LCHK5 IF NOT GO BACK TO LOOP
*////////////////////////////////////////////////*
DIV3 EQU * LABEL ENRTY POINT
MVC EOUT,FIZZ SAY FIZZ
B ENLOOP RETURN TO LOOP
*////////////////////////////////////////////////*
DIV5 EQU * LABEL ENTRY POINT
MVC EOUT,BUZZ SAY BUZZ
B ENLOOP RETURN TO LOOP
*////////////////////////////////////////////////*
DIV15 EQU * LABEL ENTRY POINT
MVC EOUT,FIZZBUZ SAY FIZZBUZZ
B ENLOOP RETURN TO LOOP
**********VARIABLE STORAGE************************
FIZZBUZ DC CL10'FIZZBUZZ!' CREATE A STRING IN MEMORY, LABEL THE ADDRESS FIZZBUZ
FIZZ DC CL10'FIZZ!' CREATE A STRING IN MEMORY, LABEL THE ADDRESS FIZZ
BUZZ DC CL10'BUZZ!' CREATE A STRING IN MEMORY, LABEL THE ADDRESS BUZZ
NUM DC PL3'0' CREATE A DECIMAL IN MEMORY, MAKE IT ZERO, LABEL IT NUM
TEMP DS D RESERVE A DOUBLE WORD (8 BYTES) IN MEMORY, LABEL IT TEMP
EMSK DC X'402020202020' CREATE A HEX ARRAY IN MEMORY, LABEL IT EMSK
WTOSTART DC Y(WTOEND-*,0) LABEL THIS WTOSTART, DEFINE A CONSTANT ADDRESS EQUAL TO
* "WTOEND" MINUS HERE(*)
EOUT DS CL10 RESERVE SPACE FOR 10 CHARACTERS, LABEL THIS EOUT
WTOEND EQU * THE MEMORY ADDRESS LOCATED HERE IS LABELED WTOEND
**********HOUSE KEEPING AREA**********************
SAVE DS 18F
END HELLO

View file

@ -1,79 +0,0 @@
.lf fzbz6502.lst
.cr 6502
.tf fzbz6502.obj,ap1
;------------------------------------------------------
; FizzBuzz for the 6502 by barrym95838 2013.04.04
; Thanks to sbprojects.com for a very nice assembler!
; The target for this assembly is an Apple II with
; mixed-case output capabilities and Applesoft
; BASIC in ROM (or language card)
; Tested and verified on AppleWin 1.20.0.0
;------------------------------------------------------
; Constant Section
;
FizzCt = 3 ;Fizz Counter (must be < 255)
BuzzCt = 5 ;Buzz Counter (must be < 255)
Lower = 1 ;Loop start value (must be 1)
Upper = 100 ;Loop end value (must be < 255)
CharOut = $fded ;Specific to the Apple II
IntOut = $ed24 ;Specific to ROM Applesoft
;======================================================
.or $0f00
;------------------------------------------------------
; The main program
;
main ldx #Lower ;init LoopCt
lda #FizzCt
sta Fizz ;init FizzCt
lda #BuzzCt
sta Buzz ;init BuzzCt
next ldy #0 ;reset string pointer (y)
dec Fizz ;LoopCt mod FizzCt == 0?
bne noFizz ; yes:
lda #FizzCt
sta Fizz ; restore FizzCt
ldy #sFizz-str ; point y to "Fizz"
jsr puts ; output "Fizz"
noFizz dec Buzz ;LoopCt mod BuzzCt == 0?
bne noBuzz ; yes:
lda #BuzzCt
sta Buzz ; restore BuzzCt
ldy #sBuzz-str ; point y to "Buzz"
jsr puts ; output "Buzz"
noBuzz dey ;any output yet this cycle?
bpl noInt ; no:
txa ; save LoopCt
pha
lda #0 ; set up regs for IntOut
jsr IntOut ; output itoa(LoopCt)
pla
tax ; restore LoopCt
noInt ldy #sNL-str
jsr puts ;output "\n"
inx ;increment LoopCt
cpx #Upper+1 ;LoopCt >= Upper+1?
bcc next ; no: loop back
rts ; yes: end main
;------------------------------------------------------
; Output zero-terminated string @ (str+y)
; (Entry point is puts, not outch)
;
outch jsr CharOut ;output string char
iny ;advance string ptr
puts lda str,y ;get a string char
bne outch ;output and loop if non-zero
rts ;return
;------------------------------------------------------
; String literals (in '+128' ascii, Apple II style)
;
str: ; string base offset
sFizz .az -"Fizz"
sBuzz .az -"Buzz"
sNL .az -#13
;------------------------------------------------------
; Variable Section
;
Fizz .da #0
Buzz .da #0
;------------------------------------------------------
.en

View file

@ -1,88 +0,0 @@
; Init the registers
mov dx,03030h ; For easier printing, the number is
;kept in Binary Coded Decimal, in
----
;the DX register.
mov ah,0Eh ; 0Eh is the IBM PC interrupt 10h
;function that does write text on
;the screen in teletype mode.
mov bl,100d ; BL is the counter (100 numbers).
xor cx,cx ; CX is a counter that will be used
;for screen printing.
xor bh,bh ; BH is the counter for counting
;multiples of three.
writeloop: ; Increment the BCD number in DX.
inc dl ; Increment the low digit
cmp dl,3Ah ; If it does not overflow nine,
jnz writeloop1 ;continue with the program,
mov dl,30h ;otherwise reset it to zero and
inc dh ;increment the high digit
writeloop1:
inc bh ; Increment the BH counter.
cmp bh,03h ; If it reached three, we did
;increment the number three times
;from the last time the number was
;a multiple of three, so the number
;is now a multiple of three now,
jz writefizz ;then we need to write "fizz" on the
;screen.
cmp dl,30h ; The number isn't a multiple of
jz writebuzz ;three, so we check if it's a
cmp dl,35h ;multiple of five. If it is, we
jz writebuzz ;need to write "buzz". The program
;checks if the last digit is zero or
;five.
mov al,dh ; If we're here, there's no need to
int 10h ;write neither "fizz" nor "buzz", so
mov al,dl ;the program writes the BCD number
int 10h ;in DX
writespace:
mov al,020h ;and a white space.
int 10h
dec bl ; Loop if we didn't process 100
jnz writeloop ;numbers.
programend: ; When we did reach 100 numbers,
cli ;the program flow falls here, where
hlt ;interrupts are cleared and the
jmp programend ;program is stopped.
writefizz: ; There's need to write "fizz":
mov si,offset fizz ; SI points to the "fizz" string,
call write ;that is written on the screen.
xor bh,bh ; BH, the counter for computing the
;multiples of three, is cleared.
cmp dl,30h ; We did write "fizz", but, if the
jz writebuzz ;number is a multiple of five, we
cmp dl,35h ;could need to write "buzz" also:
jnz writespace ;check if the number is multiple of
;five. If not, write a space and
;return to the main loop.
writebuzz: ; (The above code falls here if
;the last digit is five, otherwise
;it jumps)
mov si,offset buzz ;SI points to the "buzz" string,
call write ;that is written on the screen.
jmp writespace ; Write a space to return to the main
;loop.
write: ; Write subroutine:
mov cl,04h ; Set CX to the lenght of the string:
;both strings are 4 bytes long.
write1:
mov al,[si] ; Load the character to write in AL.
inc si ; Increment the counter SI.
int 10h ; Call interrupt 10h, function 0Eh to
;write the character and advance the
;text cursor (teletype mode)
loop write1 ; Decrement CX: if CX is not zero, do
ret ;loop, otherwise return from
;subroutine.
fizz: ;The "fizz" string.
db "fizz"
buzz: ;The "buzz" string.
db "buzz"

View file

@ -0,0 +1,5 @@
cl_demo_output=>display( VALUE stringtab( FOR i = 1 WHILE i <= 100 ( COND #( LET m3 = i MOD 3 m5 = i MOD 5 IN
WHEN m3 = 0 AND m5 = 0 THEN |FIZZBUZZ|
WHEN m3 = 0 THEN |FIZZ|
WHEN m5 = 0 THEN |BUZZ|
ELSE i ) ) ) ).

View file

@ -1,11 +0,0 @@
BEGIN {
for (NUM=1; NUM<=100; NUM++)
if (NUM % 15 == 0)
{print "FizzBuzz"}
else if (NUM % 3 == 0)
{print "Fizz"}
else if (NUM % 5 == 0)
{print "Buzz"}
else
{print NUM}
}

View file

@ -1,7 +0,0 @@
echo {1..100} | awk '
BEGIN{RS=" "}
$1 % 15 == 0 {print "FizzBuzz"}
$1 % 5 == 0 {print "Buzz"}
$1 % 3 == 0 {print "Fizz"}
{print}
'

View file

@ -1 +0,0 @@
seq 100 | awk '$0=NR%15?NR%5?NR%3?$0:"Fizz":"Buzz":"FizzBuzz"'

View file

@ -0,0 +1,10 @@
for(integer i=1; i <= 100; i++){
String output = '';
if(math.mod(i, 3) == 0) output += 'Fizz';
if(math.mod(i, 5) == 0) output += 'Buzz';
if(output != ''){
System.debug(output);
} else {
System.debug(i);
}
}

View file

@ -1,23 +1,4 @@
on run
intercalate(linefeed, ¬
map(fizzBuzz, range(1, 100)))
end run
-- fizzBuzz :: Int -> String
on fizzBuzz(x)
caseOf(x, [[my fizzAndBuzz, "FizzBuzz"], ¬
[my fizz, "Fizz"], ¬
[my buzz, "Buzz"]], ¬
x as string)
end fizzBuzz
-- fizzAndBuzz :: Int -> Bool
on fizzAndBuzz(n)
n mod 15 = 0
end fizzAndBuzz
-- FIZZBUZZ ------------------------------------------------------------------
-- fizz :: Int -> Bool
on fizz(n)
@ -29,18 +10,53 @@ on buzz(n)
n mod 5 = 0
end buzz
-- fizzAndBuzz :: Int -> Bool
on fizzAndBuzz(n)
n mod 15 = 0
end fizzAndBuzz
-- GENERIC LIBRARY FUNCTIONS
-- fizzBuzz :: Int -> String
on fizzBuzz(x)
caseOf(x, [[my fizzAndBuzz, "FizzBuzz"], ¬
[my fizz, "Fizz"], ¬
[my buzz, "Buzz"]], x as string)
end fizzBuzz
-- TEST ----------------------------------------------------------------------
on run
intercalate(linefeed, ¬
map(fizzBuzz, enumFromTo(1, 100)))
end run
-- GENERIC FUNCTIONS ---------------------------------------------------------
-- caseOf :: a -> [(predicate, b)] -> Maybe b -> Maybe b
on caseOf(e, lstPV, default)
repeat with lstCase in lstPV
set {p, v} to contents of lstCase
if mReturn(p)'s lambda(e) then return v
if mReturn(p)'s |λ|(e) then return v
end repeat
return default
end caseOf
-- enumFromTo :: Int -> Int -> [Int]
on enumFromTo(m, n)
if m > n then
set d to -1
else
set d to 1
end if
set lst to {}
repeat with i from m to n by d
set end of lst to i
end repeat
return lst
end enumFromTo
-- intercalate :: Text -> [Text] -> Text
on intercalate(strText, lstText)
set {dlm, my text item delimiters} to {my text item delimiters, strText}
@ -55,7 +71,7 @@ on map(f, xs)
set lng to length of xs
set lst to {}
repeat with i from 1 to lng
set end of lst to lambda(item i of xs, i, xs)
set end of lst to |λ|(item i of xs, i, xs)
end repeat
return lst
end tell
@ -68,21 +84,7 @@ on mReturn(f)
f
else
script
property lambda : f
property |λ| : f
end script
end if
end mReturn
-- range :: Int -> Int -> [Int]
on range(m, n)
if n < m then
set d to -1
else
set d to 1
end if
set lst to {}
repeat with i from m to n by d
set end of lst to i
end repeat
return lst
end range

View file

@ -1,11 +0,0 @@
FOR A = 1 TO 100
IF A MOD 15 = 0 THEN
PRINT "FizzBuzz"
ELSE IF A MOD 3 = 0 THEN
PRINT "Fizz"
ELSE IF A MOD 5 = 0 THEN
PRINT "Buzz"
ELSE
PRINT A
END IF
NEXT A

View file

@ -1,17 +0,0 @@
FOR A = 1 TO 100
OUT$ = ""
IF A MOD 3 = 0 THEN
OUT$ = "Fizz"
END IF
IF A MOD 5 = 0 THEN
OUT$ = OUT$ + "Buzz"
END IF
IF OUT$ = "" THEN
OUT$ = STR$(A)
END IF
PRINT OUT$
NEXT A

View file

@ -1,8 +0,0 @@
10 DEF FN M(N) = ((A / N) - INT (A / N)) * N
20 FOR A = 1 TO 100
30 LET O$ = ""
40 IF FN M(3) = 0 THEN O$ = "FIZZ"
50 IF FN M(5) = 0 THEN O$ = O$ + "BUZZ"
60 IF O$ = "" THEN O$ = STR$ (A)
70 PRINT O$
80 NEXT A

View file

@ -1,8 +0,0 @@
FOR number% = 1 TO 100
CASE TRUE OF
WHEN number% MOD 15 = 0: PRINT "FizzBuzz"
WHEN number% MOD 3 = 0: PRINT "Fizz"
WHEN number% MOD 5 = 0: PRINT "Buzz"
OTHERWISE: PRINT ; number%
ENDCASE
NEXT number%

View file

@ -0,0 +1,9 @@
for (i = 1; i <= 100; i++) {
w = 0
if (i % 3 == 0) { "Fizz"; w = 1; }
if (i % 5 == 0) { "Buzz"; w = 1; }
if (w == 0) i
if (w == 1) "
"
}
quit

View file

@ -0,0 +1,4 @@
> q
>@F5~%"d@F{ > @F q
_1>F3~%'d`Fizz`@F5~%'d >`Buzz`@FNp
;bL@~.~4~.5~5@ P<

View file

@ -0,0 +1,4 @@
>@?q
> q >Ag'd@{?p
_>"1F3~%'d`Fizz`f>@F5~%'d`Buzz`@p
b P~;"-~@~.+0~P9@N?<

View file

@ -1,9 +0,0 @@
55*4*v _ v
v <>:1-:^
|:<$ < ,*48 <
@>0"zzif">:#,_$ v
>:3%!| >0"zzub">:#,_$^
>:5%!|
v "buzz"0<>:. ^
|!%5: <
>:#,_ $> ^

View file

@ -1,156 +0,0 @@
FizzBuzz
Memory:
Zero
Zero
Counter 1
Counter 2
Zero
ASCIIDigit 3
ASCIIDigit 2
ASCIIDigit 1
Zero
Digit 3
Digit 2
Digit 1
CopyPlace
Mod 3
Mod 5
PrintNumber
TmpFlag
Counters for the loop
++++++++++[>++++++++++[>+>+<<-]<-]
Number representation in ASCII
>>>>
++++++++ ++++++++ ++++++++ ++++++++ ++++++++ ++++++++ [>+>+>+<<<-]
<<<<
>>
[
Do hundret times:
Decrement counter
->->
Increment Number
> >>+>
> >>+>
<<<<
<<<<
Check for Overflow
++++++++++
>>> >>>>
>++++++++++<
[-<<< <<<<->>>> >>> >-<]
++++++++++
<<< <<<<
Restore the digit
[->>>> >>>-<<< <<<<]
>>>> [-]+ >>>>[<<<< - >>>>[-]]<<<< <<<<
If there is an overflow
>>>>[
<<<<
>>>----------> >>>----------<+<< <<+<<
Check for Overflow
++++++++++
>> >>>>
>>++++++++++<<
[-<< <<<<->>>> >> >>-<<]
++++++++++
<< <<<<
Restore the digit
[->>>> >>-<< <<<<]
>>>> [-]+ >>>>[<<<< - >>>>[-]]<<<< <<<<
If there (again) is an overflow
>>>>[
<<<<
>>---------->> >>----------<+< <<<+<
>>>>
[-]
]<<<<
>>>>
[-]
]<<<<
>>>> >>>>
Set if to print the number
>>>[-]+<<<
Handle the Mod 3 counter
[-]+++
>>>>[-]+<<<<
>+[-<->]+++<
[->->>>[-]<<<<]
>>>>[
<[-]>
[-]
Print "Fizz"
++++++++ ++++++++ ++++++++ ++++++++
++++++++ ++++++++ ++++++++ ++++++++
++++++.
++++++++ ++++++++ ++++++++ ++++++++
+++.
++++++++ ++++++++ +..
[-]
<<<--->>>
]<<<<
Handle the Mod 5 counter
[-]+++++
>>>>[-]+<<<<
>>+[-<<->>]+++++<<
[->>->>[-]<<<<]
>>>>[
<[-]>
[-]
Print "Buzz"
++++++++ ++++++++ ++++++++ ++++++++
++++++++ ++++++++ ++++++++ ++++++++
++.
++++++++ ++++++++ ++++++++ ++++++++
++++++++ ++++++++ +++.
+++++..
[-]
<<----->>
]<<<<
Check if to print the number (Leading zeros)
>>>[
<<< <<<< <<<<
>.>.>.<<<
>>> >>>> >>>>
[-]
]<<<
<<<< <<<<
Print New Line
<<<<[-]++++ ++++ ++++ +.---.[-]>>
]
<<

View file

@ -1,5 +1 @@
#include <stdio.h>
int main() {
for (int i=1; i<=105; i++) if (i%3 && i%5) printf("%3d ", i); else printf("%s%s%s", i%3?"":"Fizz", i%5?"":"Buzz", i%15?" ":"\n");
}
for(i=0;i<100;console.log((++i%3?"":"Fizz")+(i%5?"":"Buzz")||i));

View file

@ -0,0 +1,11 @@
#include <stdio.h>
int main(void)
{
for (int i = 1; i <= 100; ++i) {
if (i % 3 == 0) printf("fizz");
if (i % 5 == 0) printf("buzz");
if (i * i * i * i % 15 == 1) printf("%d", i);
puts("");
}
}

View file

@ -0,0 +1,10 @@
#include <stdio.h>
int main()
{
for (int i=0;++i<101;puts(""))
{
char f[] = "FizzBuzz%d";
f[8-i%5&12]=0;
printf (f+(-i%3&4+f[8]/8), i);
}
}

View file

@ -1,20 +1,4 @@
#include<stdio.h>
int main (void)
{
int i;
for (i = 1; i <= 100; i++)
{
if (!(i % 15))
printf ("FizzBuzz");
else if (!(i % 3))
printf ("Fizz");
else if (!(i % 5))
printf ("Buzz");
else
printf ("%d", i);
printf("\n");
}
return 0;
}
int i = 0 ; char B[88] ;
while ( i++ < 100 )
!sprintf( B, "%s%s", i%3 ? "":"Fizz", i%5 ? "":"Buzz" )
? sprintf( B, "%d", i ):0, printf( ", %s", B );

View file

@ -1,16 +1,5 @@
#include <stdio.h>
main() {
int i = 1;
while(i <= 100) {
if(i % 15 == 0)
puts("FizzBuzz");
else if(i % 3 == 0)
puts("Fizz");
else if(i % 5 == 0)
puts("Buzz");
else
printf("%d\n", i);
i++;
}
}
int i = 0 ; char B[88] ;
while ( i++ < 100 )
!sprintf( B, "%s%s%s%s",
i%3 ? "":"Fiz", i%5 ? "":"Buz", i%7 ? "":"Goz", i%11 ? "":"Kaz" )
? sprintf( B, "%d", i ):0, printf( ", %s", B );

View file

@ -1,3 +1 @@
#include <stdio.h>
#define F(x,y) printf("%s",i%x?"":#y"zz")
int main(int i){for(--i;i++^100;puts(""))F(3,Fi)|F(5,Bu)||printf("%i",i);return 0;}
Output: ..., 89, FizBuz, Goz, 92, Fiz, 94, Buz, Fiz, 97, Goz, FizKaz, Buz

View file

@ -1,11 +1,5 @@
#include<stdio.h>
#include <stdio.h>
int main ()
{
int i;
const char *s[] = { "%d\n", "Fizz\n", s[3] + 4, "FizzBuzz\n" };
for (i = 1; i <= 100; i++)
printf(s[!(i % 3) + 2 * !(i % 5)], i);
return 0;
int main() {
for (int i=1; i<=105; i++) if (i%3 && i%5) printf("%3d ", i); else printf("%s%s%s", i%3?"":"Fizz", i%5?"":"Buzz", i%15?" ":"\n");
}

View file

@ -1,11 +1,11 @@
#include <stdio.h>
#include<stdio.h>
int main(void)
int main ()
{
for (int i = 1; i <= 100; ++i) {
if (i % 3 == 0) printf("fizz");
if (i % 5 == 0) printf("buzz");
if (i * i * i * i % 15 == 1) printf("%d", i);
puts("");
}
int i;
const char *s[] = { "%d\n", "Fizz\n", s[3] + 4, "FizzBuzz\n" };
for (i = 1; i <= 100; i++)
printf(s[!(i % 3) + 2 * !(i % 5)], i);
return 0;
}

View file

@ -1,10 +1,20 @@
#include <stdio.h>
int main()
#include<stdio.h>
int main (void)
{
for (int i=0;++i<101;puts(""))
int i;
for (i = 1; i <= 100; i++)
{
char f[] = "FizzBuzz%d";
f[8-i%5&12]=0;
printf (f+(-i%3&4+f[8]/8), i);
if (!(i % 15))
printf ("FizzBuzz");
else if (!(i % 3))
printf ("Fizz");
else if (!(i % 5))
printf ("Buzz");
else
printf ("%d", i);
printf("\n");
}
return 0;
}

View file

@ -0,0 +1,16 @@
#include <stdio.h>
main() {
int i = 1;
while(i <= 100) {
if(i % 15 == 0)
puts("FizzBuzz");
else if(i % 3 == 0)
puts("Fizz");
else if(i % 5 == 0)
puts("Buzz");
else
printf("%d\n", i);
i++;
}
}

View file

@ -0,0 +1,3 @@
#include <stdio.h>
#define F(x,y) printf("%s",i%x?"":#y"zz")
int main(int i){for(--i;i++^100;puts(""))F(3,Fi)|F(5,Bu)||printf("%i",i);return 0;}

View file

@ -1,187 +0,0 @@
Irish Soda Bread with Club Soda.
This is FizzBuzz
Ingredients.
1 l buttermilk
Method.
Take buttermilk from refrigerator.
Shake the buttermilk.
Put buttermilk into the 6th mixing bowl.
Serve with club soda.
Pour contents of the 1st mixing bowl into the 1st baking dish.
Clean the 1st mixing bowl.
Watch the buttermilk until shaked.
Serves 1.
Club Soda.
Gets whether to print fizz buzz fizzbuzz or number.
Ingredients.
70 g flour
105 g salt
122 ml milk
66 g sugar
117 ml vegetable oil
3 cups fizzle
5 cups seltzer
1 cup bmilk
1 cup ice
1 cup baking soda
1 g oregano
32 ml vinegar
1 g thyme
1 g sage
Method.
Put milk into the 1st mixing bowl.
Put salt into the 1st mixing bowl.
Put flour into the 1st mixing bowl.
Put vinegar into the 1st mixing bowl.
Put milk into the 1st mixing bowl.
Stir the 1st mixing bowl for 5 minutes.
Liquify contents of the 1st mixing bowl.
Put fizzle into the 3rd mixing bowl.
Combine seltzer into the 3rd mixing bowl.
Fold bmilk into the 6th mixing bowl.
Put bmilk into the 6th mixing bowl.
Put seltzer into the 6th mixing bowl.
Put bmilk into the 6th mixing bowl.
Serve with moist cake.
Fold bmilk into the 1st mixing bowl.
Fold sage into the 6th mixing bowl.
Fold sage into the 6th mixing bowl.
Put bmilk into the 4th mixing bowl.
Remove seltzer from the 4th mixing bowl.
Fold oregano into the 4th mixing bowl.
Smell the oregano.
Fold bmilk into the 6th mixing bowl.
Put bmilk into the 6th mixing bowl.
Put fizzle into the 6th mixing bowl.
Put bmilk into the 6th mixing bowl.
Serve with moist cake.
Fold bmilk into the 1st mixing bowl.
Fold sage into the 6th mixing bowl.
Fold sage into the 6th mixing bowl.
Put bmilk into the 4th mixing bowl.
Remove fizzle from the 4th mixing bowl.
Fold oregano into the 4th mixing bowl.
Crush the oregano.
Clean the 1st mixing bowl.
Fold bmilk into the 6th mixing bowl.
Put bmilk into the 1st mixing bowl.
Refrigerate.
Grind until crushed.
Refrigerate.
Shuffle until smelled.
Clean the 1st mixing bowl.
Put milk into the 1st mixing bowl.
Put vegetable oil into the 1st mixing bowl.
Put sugar into the 1st mixing bowl.
Put vinegar into the 1st mixing bowl.
Put milk into the 1st mixing bowl.
Stir the 1st mixing bowl for 5 minutes.
Liquify contents of the 1st mixing bowl.
Fold baking soda into the 3rd mixing bowl.
Fold bmilk into the 6th mixing bowl.
Put bmilk into the 6th mixing bowl.
Put baking soda into the 6th mixing bowl.
Put bmilk into the 6th mixing bowl.
Serve with moist cake.
Fold bmilk into the 1st mixing bowl.
Fold sage into the 6th mixing bowl.
Fold sage into the 6th mixing bowl.
Put bmilk into the 4th mixing bowl.
Remove baking soda from the 4th mixing bowl.
Fold oregano into the 4th mixing bowl.
Separate the oregano.
Refrigerate.
Part until separated.
Put fizzle into the 6th mixing bowl.
Serve with club soda.
Stir the 1st mixing bowl for 1 minute.
Stir the 1st mixing bowl for 7 minutes.
Stir the 1st mixing bowl for 1 minute.
Stir the 1st mixing bowl for 7 minutes.
Stir the 1st mixing bowl for 5 minutes.
Fold the oregano into the 1st mixing bowl.
Fold the oregano into the 1st mixing bowl.
Fold the oregano into the 1st mixing bowl.
Fold the oregano into the 1st mixing bowl.
Fold the oregano into the 1st mixing bowl.
Refrigerate.
Moist cake.
Mods a number
Ingredients.
1 cup chocolate
70 g wheat flour
1 cup white chocolate chips
1 cup baking powder
105 g honey
5 cups syrup
1 g vanilla
1 g rosemary
Method.
Fold chocolate into the 6th mixing bowl.
Fold syrup into the 6th mixing bowl.
Clean the 1st mixing bowl.
Put chocolate into the 5th mixing bowl.
Fold wheat flour into the 5th mixing bowl.
Put white chocolate chips into the 5th mixing bowl.
Remove white chocolate chips from the 5th mixing bowl.
Fold baking powder into the 5th mixing bowl.
Put baking powder into the 5th mixing bowl.
Fold honey into the 5th mixing bowl.
Sift the wheat flour.
Put honey into the 5th mixing bowl.
Add white chocolate chips into the 5th mixing bowl.
Fold honey into the 5th mixing bowl.
Put honey into the 5th mixing bowl.
Remove syrup from the 5th mixing bowl.
Fold vanilla into the 5th mixing bowl.
Sprinkle the vanilla.
Put white chocolate chips into the 5th mixing bowl.
Remove white chocolate chips from the 5th mixing bowl.
Fold rosemary into the 5th mixing bowl.
Set aside.
Move until sprinkled.
Recite the rosemary.
Put white chocolate chips into the 5th mixing bowl.
Remove white chocolate chips from the 5th mixing bowl.
Fold honey into the 5th mixing bowl.
Put baking powder into the 5th mixing bowl.
Add white chocolate chips into the 5th mixing bowl.
Fold baking powder into the 5th mixing bowl.
Set aside.
Repeat until recited.
Put white chocolate chips into the 5th mixing bowl.
Fold rosemary into the 5th mixing bowl.
Shuffle the wheat flour until sifted.
Put the baking powder into the 5th mixing bowl.
Combine syrup into the 5th mixing bowl.
Fold honey into the 5th mixing bowl.
Put chocolate into the 5th mixing bowl.
Remove honey from the 5th mixing bowl.
Fold chocolate into the 5th mixing bowl.
Put white chocolate chips into the 5th mixing bowl.
Fold rosemary into the 5th mixing bowl.
Siphon chocolate.
Put white chocolate chips into the 5th mixing bowl.
Remove white chocolate chips from the 5th mixing bowl.
Fold rosemary into the 5th mixing bowl.
Set aside.
Gulp until siphoned.
Quote the rosemary.
Put syrup into the 5th mixing bowl.
Fold chocolate into the 5th mixing bowl.
Set aside.
Repeat until quoted.
Put chocolate into the 1st mixing bowl.
Refrigerate.

View file

@ -1,7 +1,7 @@
<cfscript>
result = "";
for(i=1;i<=100;i++){
result=ListAppend(result, (i%15==0) ? "FizzBuzz": (i%5==0) ? "Buzz" : (i%3 eq 0)? "Fizz" : i );
result=ListAppend(result, (i%15==0) ? "FizzBuzz": (i%5==0) ? "Buzz" : (i%3 eq 0)? "Fizz" : i );
}
WriteOutput(result);
</cfscript>

View file

@ -0,0 +1,24 @@
fizzbuzz
mod_three = 3
mod_five = 5
comefrom fizzbuzz
n
comefrom fizzbuzz if n is mod_three
comefrom fizzbuzz if n is mod_five
n = n + 1
fizz
comefrom fizzbuzz if n is mod_three
'Fizz'...
mod_three = mod_three + 3
linebreak
# would like to write "unless mod_three is mod_five"
comefrom fizz if mod_three - mod_five - 3
''
buzz
comefrom fizzbuzz if n is mod_five
'Buzz'
mod_five = mod_five + 5
comefrom fizzbuzz if n is 100

View file

@ -0,0 +1,16 @@
(defun core (x)
(mapcar
#'(lambda (a b) (if (equal 0 (mod x a)) b x))
'(3 5)
'("fizz" "buzz")))
(defun filter-core (x)
(if (equal 1 (length (remove-duplicates x)))
(list (car x))
(remove-if-not #'stringp x)))
(defun fizzbuzz (x)
(loop for a from 1 to x do
(print (format nil "~{~a~}" (filter-core (core a))))))
(fizzbuzz 100)

View file

@ -0,0 +1,2 @@
[$$3/%$[]['F,'i,'z,'z,]?\5/%$[]['B,'u,'z,'z,]?*[$.][]?10,]c: {define function c: mod 3, mod 5 tests, print proper output}
0[$100<][1+c;!]# {loop from 1 to 100}

View file

@ -0,0 +1,3 @@
[\[^^>][$;,1+]#%%]⇒P {define operator P: print stored string}
[$$3/%$[][0$"Fizz"P]?\5/%$[][0$"Buzz"P]?*[$.][]?10,]c: {define function c: mod 3, mod 5 tests, print according output}
0[$100<][1+c;!]# {loop from 1 to 100}

View file

@ -1,5 +1,10 @@
main() {
for (int i = 1; i <= 100; i++) {
print((i % 3 == 0 ? "Fizz" : "") + (i % 5 == 0 ? "Buzz" : "") + (i % 3 != 0 && i % 5 != 0 ? "$i" : ""));
List<String> out = [];
if (i % 3 == 0)
out.add("Fizz");
if (i % 5 == 0)
out.add("Buzz");
print(out.length > 0 ? out.join("") : i);
}
}

View file

@ -0,0 +1,16 @@
[[Fizz]P 1 sw]sF
[[Buzz]P 1 sw]sB
[li p sz]sN
[[
]P]sW
[
0 sw [w = 0]sz
li 3 % 0 =F [Fizz if 0 == i % 3]sz
li 5 % 0 =B [Buzz if 0 == i % 5]sz
lw 0 =N [print Number if 0 == w]sz
lw 1 =W [print neWline if 1 == w]sz
li 1 + si [i += 1]sz
li 100 !<L [continue Loop if 100 >= i]sz
]sL
1 si [i = 1]sz
0 0 =L [enter Loop]sz

View file

@ -0,0 +1,18 @@
# dc is stack based, so we use the stack instead of a variable for our
# current number.
1 # Number = 1
[[Fizz]n 1 sw]sF # Prints "Fizz" prevents Number from printing
[[Buzz]n 1 sw]sB # Prints "Buzz" prevents Number from printing
[dn]sN # Prints Number
[
dd # Put two extra copies of Number on stack
0 sw # w = 0
3% 0=F # Fizz if 0 == Number % 3 (destroys 1st copy)
5% 0=B # Buzz if 0 == Number % 5 (destroys 2nd copy)
lw 0=N # Print Number if 0 == w
[
]n # Print new line
1+d # Number += 1 and put extra copy on stack
100!<L # Continue Loop if 100 >= Number (destroys copy)
]dsLx # Enter Loop

View file

@ -1,4 +0,0 @@
[\$@$@\/*=]d:
[1\$3d;!["Fizz"\%0\]?$5d;!["Buzz"\%0\]?\[$.]?"
"]f:
0[$100\>][1+f;!]#%

View file

@ -0,0 +1,13 @@
Public Sub Main()
Dim siCount As Short
Dim sText As String
For siCount = 1 To 100
sText = ""
If siCount Mod 3 = 0 Then sText = "Fizz"
If siCount Mod 5 = 0 Then sText = "Buzz"
If siCount Mod 15 = 0 Then sText = "FizzBuzz"
If sText Then Print sText Else Print siCount
Next
End

View file

@ -0,0 +1,20 @@
@prefix u "http://www.genyris.org/lang/utilities#"
def fizzbuzz (n)
map-left ^((3 = 'fizz') (5 = 'buzz'))
lambda (d)
cond
(equal? 0 (% n d!left))
d!right
else
''
for n in (range 1 100)
define fb (''(.join (fizzbuzz n)))
u:format "%a\n"
cond
(equal? fb '')
n
else
fb

View file

@ -0,0 +1,16 @@
module FizzBuzz
augment java.lang.Integer {
function getFizzAndOrBuzz = |this| -> match {
when this % 15 == 0 then "FizzBuzz"
when this % 3 == 0 then "Fizz"
when this % 5 == 0 then "Buzz"
otherwise this
}
}
function main = |args| {
foreach i in [1..101] {
println(i: getFizzAndOrBuzz())
}
}

View file

@ -1,3 +1 @@
for (i in 1..100) {
println "${i%3?'':'Fizz'}${i%5?'':'Buzz'}" ?: i
}
1.upto(100, { i -> println "${i % 3 ? '' : 'Fizz'}${i % 5 ? '' : 'Buzz'}" ?: i })

View file

@ -0,0 +1,12 @@
U8 i;
for (i = 1; i <= 100; i++) {
if (!(i % 15))
Print("FizzBuzz");
else if (!(i % 3))
Print("Fizz");
else if (!(i % 5))
Print("Buzz");
else
Print("%d", i);
Print("\n");
}

View file

@ -1,7 +1,8 @@
partial
fizzBuzz : Nat -> String
fizzBuzz n = if (n `mod` 15) == 0 then "FizzBuzz"
else if (n `mod` 3) == 0 then "Fizz"
else if (n `mod` 5) == 0 then "Buzz"
fizzBuzz n = if (n `modNat` 15) == 0 then "FizzBuzz"
else if (n `modNat` 3) == 0 then "Fizz"
else if (n `modNat` 5) == 0 then "Buzz"
else show n
main : IO ()

View file

@ -1,15 +0,0 @@
public class FizzBuzz{
public static void main(String[] args){
for(int i= 1; i <= 100; i++){
if(i % 15 == 0){
System.out.println("FizzBuzz");
}else if(i % 3 == 0){
System.out.println("Fizz");
}else if(i % 5 == 0){
System.out.println("Buzz");
}else{
System.out.println(i);
}
}
}
}

View file

@ -1,11 +0,0 @@
public class FizzBuzz{
public static void main(String[] args){
for(int i= 1; i <= 100; i++){
String output = "";
if(i % 3 == 0) output += "Fizz";
if(i % 5 == 0) output += "Buzz";
if(output.equals("")) output += i;
System.out.println(output);
}
}
}

View file

@ -1,8 +0,0 @@
public class FizzBuzz{
public static void main(String[] args){
for(int i= 1; i <= 100; i++){
System.out.println(i % 15 != 0 ? i % 5 != 0 ? i % 3 != 0 ?
i : "Fizz" : "Buzz" : "FizzBuzz");
}
}
}

View file

@ -1,12 +0,0 @@
public String fizzBuzz(int n){
String s = "";
if (n == 0)
return s;
if((n % 5) == 0)
s = "Buzz" + s;
if((n % 3) == 0)
s = "Fizz" + s;
if (s.equals(""))
s = n + "";
return fizzBuzz(n-1) + s;
}

View file

@ -1,5 +0,0 @@
public String fizzBuzz(int n){
return (n>0) ? fizzBuzz(n-1) +
(n % 15 != 0? n % 5 != 0? n % 3 != 0? (n+"") :"Fizz" : "Buzz" : "FizzBuzz")
: "";
}

View file

@ -1,7 +0,0 @@
class FizzBuzz {
public static void main( String [] args ) {
for( int i = 1 ; i <= 100 ; i++ ) {
System.out.println( new String[]{ i+"", "Fizz", "Buzz", "FizzBuzz" }[ ( i%3==0?1:0 ) + ( i%5==0?2:0 ) ]);
}
}
}

View file

@ -1,11 +1 @@
(function rng(i) {
return i ? rng(i - 1).concat(i) : []
})(100).map(
function (n) {
return n % 3 ? (
n % 5 ? n : "Buzz"
) : (
n % 5 ? "Fizz" : "FizzBuzz"
)
}
).join(' ')
for(i=1;i<101;i++)console.log((i%3?'':'Fizz')+(i%5?'':'Buzz')||i)

View file

@ -1,8 +1,11 @@
(function() {
var i;
for (i = 1; i <= 100; i++) {
console.log([i % 3 === 0 ? 'Fizz' : void 0] + [i % 5 === 0 ? 'Buzz' : void 0] || i);
}
}).call(this);
(function rng(i) {
return i ? rng(i - 1).concat(i) : []
})(100).map(
function (n) {
return n % 3 ? (
n % 5 ? n : "Buzz"
) : (
n % 5 ? "Fizz" : "FizzBuzz"
)
}
).join(' ')

View file

@ -1,25 +1,36 @@
var divs = [15, 3, 5];
var says = ['FizzBuzz', 'Fizz', 'Buzz'];
(() => {
function fizzBuzz(first, last) {
for (var n = first; n <= last; n++) {
print(getFizzBuzz(n));
}
}
// FIZZBUZZ --------------------------------------------------------------
function getFizzBuzz(n) {
var sayWhat = n;
for (var d = 0; d < divs.length; d++) {
if (isMultOf(n, divs[d])) {
sayWhat = says[d];
break;
}
}
return sayWhat;
}
// fizzBuzz :: Int -> String
const fizzBuzz = n =>
caseOf(n, [
[x => x % 15 === 0, "FizzBuzz"],
[x => x % 3 === 0, "Fizz"],
[x => x % 5 === 0, "Buzz"]
], n.toString());
function isMultOf(n, d) {
return n % d == 0;
}
// GENERIC FUNCTIONS -----------------------------------------------------
fizzBuzz(1, 100);
// caseOf :: a -> [(a -> Bool, b)] -> b -> b
const caseOf = (e, pvs, otherwise) =>
pvs.reduce((a, [p, v]) =>
a !== otherwise ? a : (p(e) ? v : a), otherwise);
// enumFromTo :: Int -> Int -> [Int]
const enumFromTo = (m, n) =>
Array.from({
length: Math.floor(n - m) + 1
}, (_, i) => m + i);
// map :: (a -> b) -> [a] -> [b]
const map = (f, xs) => xs.map(f);
// unlines :: [String] -> String
const unlines = xs => xs.join('\n');
// TEST ------------------------------------------------------------------
return unlines(
map(fizzBuzz, enumFromTo(1, 100))
);
})();

View file

@ -0,0 +1 @@
{,/$(s;x)@~#s:`Fizz`Buzz@&~x!'3 5}'1+!30

View file

@ -1,11 +1 @@
{[fizzy buzzy fizzybuzzy];
fizzy::x!3;
buzzy::x!5;
fizzybuzzy::(fizzy+buzzy);
:[0=fizzybuzzy;.d("FizzBuzz")
:|0=fizzy;
.d("Fizz")
:|0=buzzy;
.d("Buzz");
.d(x)];
.d(" ")}'1+!100
{:[0=x!15;:FizzBuzz:|0=x!5;:Buzz:|0=x!3;:Fizz;x]}'1+!100

View file

@ -1,7 +1,7 @@
fun fizzBuzz() {
fun fizzbuzz(x: Int) = if(x % 15 == 0) "FizzBuzz" else x
fun fizz(x: Any) = if(x is Int && x % 3 == 0) "Buzz" else x
fun buzz(x: Any) = if(x is Int && x.toInt() % 5 == 0) "Fizz" else x
fun fizzBuzz1() {
fun fizzBuzz(x: Int) = if (x % 15 == 0) "FizzBuzz" else x.toString()
fun fizz(x: Any) = if (x is Int && x % 3 == 0) "Buzz" else x
fun buzz(x: Any) = if (x is Int && x.toInt() % 5 == 0) "Fizz" else x
(1..100).map { fizzbuzz(it) }.map { fizz(it) }.map { buzz(it) }.forEach { println(it) }
(1..100).map { fizzBuzz(it) }.map { fizz(it) }.map { buzz(it) }.forEach { println(it) }
}

View file

@ -1,4 +1,4 @@
fun fizzBuzz() {
fun fizzBuzz2() {
fun fizz(x: Pair<Int, StringBuilder>) = if(x.first % 3 == 0) x.apply { second.append("Fizz") } else x
fun buzz(x: Pair<Int, StringBuilder>) = if(x.first % 5 == 0) x.apply { second.append("Buzz") } else x
fun none(x: Pair<Int, StringBuilder>) = if(x.second.isBlank()) x.second.apply { append(x.first) } else x.second

View file

@ -1,18 +0,0 @@
HAI 1.3
IM IN YR fizz UPPIN YR i TIL BOTH SAEM i AN 100
I HAS A i ITZ SUM OF i AN 1 BTW, ALL LUPZ START AT 0 :/
I HAS A mod3 ITZ NOT MOD OF i AN 3
I HAS A mod5 ITZ NOT MOD OF i AN 5
mod3, O RLY?, YA RLY, VISIBLE "Fizz"!, OIC
mod5, O RLY?, YA RLY, VISIBLE "Buzz"!, OIC
NOT EITHER OF mod3 AN mod5, O RLY?
YA RLY, VISIBLE i!
OIC
VISIBLE ""
IM OUTTA YR fizz
KTHXBYE

View file

@ -1,12 +0,0 @@
for i = 1 to 100
select case
case i mod 15 = 0
print "FizzBuzz"
case i mod 3 = 0
print "Fizz"
case i mod 5 = 0
print "Buzz"
case else
print i
end select
next i

View file

@ -0,0 +1,28 @@
MOD3 = 0
MOD5 = 0
ALL != jot 100
all: say-100
.for NUMBER in $(ALL)
MOD3 != expr \( $(MOD3) + 1 \) % 3; true
MOD5 != expr \( $(MOD5) + 1 \) % 5; true
. if "$(NUMBER)" > 1
PRED != expr $(NUMBER) - 1
say-$(NUMBER): say-$(PRED)
. else
say-$(NUMBER):
. endif
. if "$(MOD3)$(MOD5)" == "00"
@echo FizzBuzz
. elif "$(MOD3)" == "0"
@echo Fizz
. elif "$(MOD5)" == "0"
@echo Buzz
. else
@echo $(NUMBER)
. endif
.endfor

View file

@ -0,0 +1,4 @@
for i = 1,100
print ((a) -> a == "" and i or a) table.concat {
i % 3 == 0 and "Fizz" or ""
i % 5 == 0 and "Buzz" or ""}

View file

@ -1,9 +0,0 @@
for i in 1..100:
if i mod 15 == 0:
echo("FizzBuzz")
elif i mod 3 == 0:
echo("Fizz")
elif i mod 5 == 0:
echo("Buzz")
else:
echo(i)

View file

@ -1,6 +0,0 @@
var messages = @["", "Fizz", "Buzz", "FizzBuzz"]
var acc = 810092048
for i in 1..100:
var c = acc and 3
echo(if c == 0: $i else: messages[c])
acc = acc shr 2 or c shl 28

View file

@ -0,0 +1,23 @@
C :i = 0
*loop
C :i = i + 1
J ( i > 100 ) : *finished
C :modulo = i % 15
J ( modulo = 0 ) : *fizzbuzz
C :modulo = i % 3
J ( modulo = 0 ) : *fizz
C :modulo = i % 5
J ( modulo = 0 ) : *buzz
T :#i
J : *loop
*fizzbuzz
T :FizzBuzz
J : *loop
*fizz
T :Fizz
J : *loop
*buzz
T :Buzz
J : *loop
*finished
END:

View file

@ -0,0 +1,11 @@
sub fizz_buzz {
join("\n", map {
sub mult {$_ % shift == 0};
my @out;
if (mult 3) { push @out, "Fizz"; }
if (mult 5) { push @out, "Buzz"; }
if (!@out) {push @out, $_; }
join('', @out);
} (1..100))."\n";
}
print fizz_buzz;

View file

@ -1,9 +0,0 @@
<# DEFINE USERDEFINEDROUTINE LITERAL>__FizzBuzz|<# SUPPRESSAUTOMATICWHITESPACE>
<# TEST ISITMODULUSZERO PARAMETER LITERAL>1|3</#>
<# TEST ISITMODULUSZERO PARAMETER LITERAL>1|5</#>
<# ONLYFIRSTOFLASTTWO><# SAY LITERAL>Fizz</#></#>
<# ONLYSECONDOFLASTTWO><# SAY LITERAL>Buzz</#></#>
<# BOTH><# SAY LITERAL>FizzBuzz</#></#>
<# NEITHER><# SAY PARAMETER>1</#></#>
</#></#>
<# ITERATE FORITERATION LITERAL LITERAL>100|<# ACT USERDEFINEDROUTINE POSITION FORITERATION>__FizzBuzz|...</#> </#>

View file

@ -1,9 +0,0 @@
<@ DEFUDRLIT>__FizzBuzz|<@ SAW>
<@ TSTMD0PARLIT>1|3</@>
<@ TSTMD0PARLIT>1|5</@>
<@ O12><@ SAYLIT>Fizz</@></@>
<@ O22><@ SAYLIT>Buzz</@></@>
<@ BTH><@ SAYLIT>FizzBuzz</@></@>
<@ NTH><@ SAYPAR>1</@></@>
</@></@>
<@ ITEFORLITLIT>100|<@ ACTUDRPOSFOR>__FizzBuzz|...</@> </@>

View file

@ -1,13 +0,0 @@
OpenConsole()
For x = 1 To 100
If x%15 = 0
PrintN("FizzBuzz")
ElseIf x%3 = 0
PrintN("Fizz")
ElseIf x%5 = 0
PrintN("Buzz")
Else
PrintN(Str(x))
EndIf
Next
Input()

View file

@ -1,13 +1,3 @@
from itertools import cycle, izip, count, islice
fizzes = cycle([""] * 2 + ["Fizz"])
buzzes = cycle([""] * 4 + ["Buzz"])
both = (f + b for f, b in izip(fizzes, buzzes))
# if the string is "", yield the number
# otherwise yield the string
fizzbuzz = (word or n for word, n in izip(both, count(1)))
# print the first 100
for i in islice(fizzbuzz, 100):
print i
for n in range(1, 100):
fb = ''.join([ denom[1] if n % denom[0] == 0 else '' for denom in [(3,'fizz'),(5,'buzz')] ])
print fb if fb else n

View file

@ -1,2 +1 @@
for i in range(1, 101):
print 'Fizz'*(not(i%3))+'Buzz'*(not(i%5)) or i
[print("FizzBuzz") if i % 15 == 0 else print("Fizz") if i % 3 == 0 else print("Buzz") if i % 5 == 0 else print(i) for i in range(1,101)]

View file

@ -1,6 +1,13 @@
messages = [None, "Fizz", "Buzz", "FizzBuzz"]
acc = 810092048
for i in xrange(1, 101):
c = acc & 3
print messages[c] if c else i
acc = acc >> 2 | c << 28
from itertools import cycle, izip, count, islice
fizzes = cycle([""] * 2 + ["Fizz"])
buzzes = cycle([""] * 4 + ["Buzz"])
both = (f + b for f, b in izip(fizzes, buzzes))
# if the string is "", yield the number
# otherwise yield the string
fizzbuzz = (word or n for word, n in izip(both, count(1)))
# print the first 100
for i in islice(fizzbuzz, 100):
print i

View file

@ -1,14 +0,0 @@
>>> ' '.join(''.join(''.join(['' if i%3 else 'F',
'' if i%5 else 'B'])
or str('00'))
for i in range(1,16))
'00 00 F 00 B F 00 00 F B 00 F 00 00 FB'
>>> _
'00 00 F 00 B F 00 00 F B 00 F 00 00 FB'
>>> _.replace('FB','11').replace('F','01').replace('B','10').split()[::-1]
['11', '00', '00', '01', '00', '10', '01', '00', '00', '01', '10', '00', '01', '00', '00']
>>> '0b' + ''.join(_)
'0b110000010010010000011000010000'
>>> eval(_)
810092048
>>>

View file

@ -1,6 +0,0 @@
import random
for i in range(0, 100):
if not i % 15:
random.seed(1178741599)
print [i+1, "Fizz", "Buzz", "FizzBuzz"][random.randint(0,3)]

View file

@ -1,13 +0,0 @@
from itertools import cycle, izip, count, islice
fizzes = cycle([""] * 2 + ["Fizz"])
buzzes = cycle([""] * 4 + ["Buzz"])
both = (f + b for f, b in izip(fizzes, buzzes))
# if the string is "", yield the number
# otherwise yield the string
fizzbuzz = (word or n for word, n in izip(both, count(1)))
# print the first 100
for i in islice(fizzbuzz, 100):
print i

View file

@ -1,11 +0,0 @@
For i As Integer = 1 To 100
If i mod 3 = 0 And i mod 5 = 0 Then
Print("FizzBuzz")
ElseIf i mod 3 = 0 Then
Print("Fizz")
ElseIf i mod 5 = 0 Then
Print("Buzz")
Else
Print(Str(i))
End If
Next

View file

@ -1,7 +0,0 @@
for i = 1 to 100
print i;
if (i mod 15) = 0 then print " FuzzBuzz";
if (i mod 3) = 0 then print " Fuzz";
if (i mod 5) = 0 then print " Buzz";
print
next i

View file

@ -1,12 +1,11 @@
use std::borrow::Cow;
fn main() {
for i in 1..101 {
let word: Cow<_> = match (i % 3, i % 5) {
(0,0) => "FizzBuzz".into(),
(0,_) => "Fizz".into(),
(_, 0) => "Buzz".into(),
_ => i.to_string().into(),
};
println!("{}", word);
let result = (1..101).map(|n| match (n % 3, n % 5) {
(0, 0) => "FizzBuzz".to_owned(),
(0, _) => "Fizz".to_owned(),
(_, 0) => "Buzz".to_owned(),
_ => n.to_string()
});
for r in result {
println!("{}", r);
}
}

View file

@ -1,37 +1,11 @@
#![no_std]
#![feature(asm, lang_items, libc, no_std, start)]
extern crate libc;
const LEN: usize = 413;
static OUT: [u8; LEN] = *b"\
1\n2\nFizz\n4\nBuzz\nFizz\n7\n8\nFizz\nBuzz\n11\nFizz\n13\n14\nFizzBuzz\n\
16\n17\nFizz\n19\nBuzz\nFizz\n22\n23\nFizz\nBuzz\n26\nFizz\n28\n29\nFizzBuzz\n\
31\n32\nFizz\n34\nBuzz\nFizz\n37\n38\nFizz\nBuzz\n41\nFizz\n43\n44\nFizzBuzz\n\
46\n47\nFizz\n49\nBuzz\nFizz\n52\n53\nFizz\nBuzz\n56\nFizz\n58\n59\nFizzBuzz\n\
61\n62\nFizz\n64\nBuzz\nFizz\n67\n68\nFizz\nBuzz\n71\nFizz\n73\n74\nFizzBuzz\n\
76\n77\nFizz\n79\nBuzz\nFizz\n82\n83\nFizz\nBuzz\n86\nFizz\n88\n89\nFizzBuzz\n\
91\n92\nFizz\n94\nBuzz\nFizz\n97\n98\nFizz\nBuzz\n";
#[start]
fn start(_argc: isize, _argv: *const *const u8) -> isize {
unsafe {
asm!(
"
mov $$1, %rax
mov $$1, %rdi
mov $0, %rsi
mov $1, %rdx
syscall
"
:
: "r" (&OUT[0]) "r" (LEN)
: "rax", "rdi", "rsi", "rdx"
:
);
fn main() {
for i in 1..101 {
let word = match (i % 3, i % 5) {
(0, 0) => "FizzBuzz".to_owned(),
(0, _) => "Fizz".to_owned(),
(_, 0) => "Buzz".to_owned(),
_ => i.to_string().to_owned(),
};
println!("{}", word);
}
0
}
#[lang = "eh_personality"] extern fn eh_personality() {}
#[lang = "panic_fmt"] extern fn panic_fmt() {}

View file

@ -1,16 +1,37 @@
// rust 0.11
#![no_std]
#![feature(asm, lang_items, libc, no_std, start)]
fn main() {
for num in std::iter::range_inclusive(1i, 100) {
println!("{}", fizzbuzz(num))
extern crate libc;
const LEN: usize = 413;
static OUT: [u8; LEN] = *b"\
1\n2\nFizz\n4\nBuzz\nFizz\n7\n8\nFizz\nBuzz\n11\nFizz\n13\n14\nFizzBuzz\n\
16\n17\nFizz\n19\nBuzz\nFizz\n22\n23\nFizz\nBuzz\n26\nFizz\n28\n29\nFizzBuzz\n\
31\n32\nFizz\n34\nBuzz\nFizz\n37\n38\nFizz\nBuzz\n41\nFizz\n43\n44\nFizzBuzz\n\
46\n47\nFizz\n49\nBuzz\nFizz\n52\n53\nFizz\nBuzz\n56\nFizz\n58\n59\nFizzBuzz\n\
61\n62\nFizz\n64\nBuzz\nFizz\n67\n68\nFizz\nBuzz\n71\nFizz\n73\n74\nFizzBuzz\n\
76\n77\nFizz\n79\nBuzz\nFizz\n82\n83\nFizz\nBuzz\n86\nFizz\n88\n89\nFizzBuzz\n\
91\n92\nFizz\n94\nBuzz\nFizz\n97\n98\nFizz\nBuzz\n";
#[start]
fn start(_argc: isize, _argv: *const *const u8) -> isize {
unsafe {
asm!(
"
mov $$1, %rax
mov $$1, %rdi
mov $0, %rsi
mov $1, %rdx
syscall
"
:
: "r" (&OUT[0]) "r" (LEN)
: "rax", "rdi", "rsi", "rdx"
:
);
}
0
}
fn fizzbuzz(num: int) -> String {
match (num % 3, num % 5) {
(0, 0) => format!("FizzBuzz"),
(0, _) => format!("Fizz"),
(_, 0) => format!("Buzz"),
(_, _) => format!("{}", num),
}
}
#[lang = "eh_personality"] extern fn eh_personality() {}
#[lang = "panic_fmt"] extern fn panic_fmt() {}

View file

@ -1,20 +0,0 @@
// rust 0.8
fn main() {
let mut n:uint = 1;
while n <= 100 {
if n % 15 == 0 {
println("FizzBuzz");
}
else if n % 3 == 0 {
println("Fizz");
}
else if n % 5 == 0 {
println("Buzz");
}
else {
println(n.to_str());
}
n += 1;
}
}

View file

@ -1,11 +0,0 @@
// rust 0.8
fn main() { for n in std::iter::range_inclusive(1,100) { fizzbuzz(n) }}
fn fizzbuzz(n:int) {
let mut buf = ~"";
if n % 3 == 0 { buf.push_str("Fizz") }
if n % 5 == 0 { buf.push_str("Buzz") }
if buf != ~"" { println!("{}", buf ) }
else { println!("{}", n ) }
}

View file

@ -1,14 +0,0 @@
// rust 0.8
fn main() {
for num in std::iter::range_inclusive(1, 100) {
println(
match (num % 3, num % 5) {
(0, 0) => ~"FizzBuzz",
(0, _) => ~"Fizz",
(_, 0) => ~"Buzz",
(_, _) => num.to_str()
}
);
}
}

View file

@ -1,14 +0,0 @@
// rust 0.8
fn main() {
for num in std::iter::range_inclusive(1, 100) {
println(
match (num % 3 == 0, num % 5 == 0) {
(false, false) => num.to_str(),
(true, false) => ~"Fizz",
(false, true) => ~"Buzz",
(true, true) => ~"FizzBuzz"
}
);
}
}

View file

@ -1,20 +0,0 @@
// rust 0.8
fn main() {
for num in range(1,101) {
let answer =
if num % 15 == 0 {
~"FizzBuzz"
}
else if num % 3 == 0 {
~"Fizz"
}
else if num % 5 == 0 {
~"Buzz"
}
else {
num.to_str()
};
println(answer);
}
}

View file

@ -1,35 +0,0 @@
/ 'B' @=@@=@@++++#
// / 'u' @@@@@=@+++++#
// // / 'z' @=@@@@+@++++#
// // // / 'i' @@@@@@=+++++#
// // // // / 'F' @@@=@@+++++#
// // // // // / LF ++++++++++#
// // // // // // / 100 @@@=@@@=++++#
$@/>@/>@/>@/>@/>@/>@/\ 0
/ /
! /======= Fizz <<<.<.<..>>>#
/ | \
\?!#->+ @\.>?!#->+ @\.>?!#->+@/.>\ |
/ ! ! ! / |
\?!#->+ @\.>?!#->+@\ .>?!#->+@/.>\ |
/ ! \!===\! ! / |
\?!#->+ @\.>?!#->+ @\.>?!#->+@/.>\ |
/ ! ! | ! / |
\?!#->+@\ .>?!#->+ @\.>?!#->+@/.>\ |
/ \!==========!===\! ! / |
\?!#->+ @\.>?!#->+ @\.>?!#->+@/>>@\.>/
! | | |
/==========/ \========!\=== Buzz <<<<<<<.>.>..>>>#
|
\!/=dup==?\>>@\<!/back?\<<<#
\<<+>+>-/ | \>+<- /
|
/======================/
|
| /recurse\ #/?\ zero
\print=!\@\>?!\@/<@\.!\-/
| \=/ \=itoa=@@@+@+++++#
! /+ !/+ !/+ !/+ \ mod10
/<+> -\!?-\!?-\!?-\!?-\!
\?!\-?!\-?!\-?!\-?!\-?/\ div10
# +/! +/! +/! +/! +/

View file

@ -1 +1 @@
seq 1 100 | sed -r '3~3 s/[0-9]*/Fizz/; 5~5 s/[0-9]*$/Buzz/'
seq 100 | sed '/.*[05]$/s//Buzz/;n;s//Buzz/;n;s//Buzz/;s/^[0-9]*/Fizz/'

View file

@ -0,0 +1 @@
seq 100 | sed '0~3 s/.*/Fizz/; 0~5 s/[0-9]*$/Buzz/'

View file

@ -0,0 +1 @@
yes | sed -n '0~3s/y/Fizz/;0~5s/y*$/Buzz/;tx;=;b;:x;p;100q'

View file

@ -0,0 +1 @@
sed -nz '0~3s/^/Fizz/;0~5s/$/Buzz/;tx;=;b;:x;p;100q' /dev/zero | sed 'y/\c@/\n/'

View file

@ -1,14 +0,0 @@
local
fun fbstr i =
case (i mod 3 = 0, i mod 5 = 0) of
(true , true ) => "FizzBuzz"
| (true , false) => "Fizz"
| (false, true ) => "Buzz"
| (false, false) => Int.toString i
fun fizzbuzz' (n, j) =
if n = j then () else (print (fbstr j ^ "\n"); fizzbuzz' (n, j+1))
in
fun fizzbuzz n = fizzbuzz' (n, 1)
val _ = fizzbuzz 100
end

View file

@ -1,8 +0,0 @@
local
fun fb i = let val fizz = i mod 3 = 0 andalso (print "Fizz"; true)
val buzz = i mod 5 = 0 andalso (print "Buzz"; true)
in fizz orelse buzz orelse (print (Int.toString i); true) end
in
fun fizzbuzz n = (List.tabulate (n, fn i => (fb (i+1); print "\n")); ())
val _ = fizzbuzz 100
end

View file

@ -1,16 +0,0 @@
PROGRAM:FIZZBUZZ
:For(I,1,100)
:0→N
:If fPart(I/5)=0
:2→N
:If fPart(I/3)=0
:1+N→N
:If N=0
:Disp I
:If N=1
:Disp "FIZZ"
:If N=2
:Disp "BUZZ"
:If N=3
:Disp "FIZZBUZZ"
:End

View file

@ -0,0 +1,10 @@
: FIZZBUZZ
101 1 DO
I 15 MOD 0 = IF
PRINT " FIZZBUZZ "
ELSE I 3 MOD 0 = IF
PRINT " FIZZ "
ELSE I 5 MOD 0 = IF
PRINT " BUZZ "
ELSE I . THEN THEN THEN
CR LOOP ;

View file

@ -1,15 +0,0 @@
Sub Main()
For i = 1 To 100
If i Mod 15 = 0 Then
Console.WriteLine("FizzBuzz")
ElseIf i Mod 5 = 0 Then
Console.WriteLine("Buzz")
ElseIf i Mod 3 = 0 Then
Console.WriteLine("Fizz")
Else
Console.WriteLine(i)
End If
Next
End Sub

View file

@ -1,29 +0,0 @@
push 1 ; Initialize a counter.
0:
dup dup ; Get two copies for the mod checks.
push 3 mod jz 1
push 5 mod jz 2
dup onum jump 4 ; If we're still here, just print the number.
1: ; Print "Fizz", then maybe "Buzz".
push F ochr
push i ochr
call 3 push 5 mod
jz 2
jump 4
2: ; Print "Buzz".
push B ochr
push u ochr
call 3 jump 4
3: ; Print "zz"; called as a function for convenient return.
push z dup ochr ochr ret
4:
push 10 ochr ; Print a newline.
push 1 add dup ; Increment the counter.
push 101 sub
jn 0 ; Go again unless we're at 100.
pop exit ; Exit clean.

Some files were not shown because too many files have changed in this diff Show more