Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,16 +0,0 @@
|
|||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
|
||||
procedure Fizzbuzz is
|
||||
begin
|
||||
for I in 1..100 loop
|
||||
if I mod 15 = 0 then
|
||||
Put_Line("FizzBuzz");
|
||||
elsif I mod 5 = 0 then
|
||||
Put_Line("Buzz");
|
||||
elsif I mod 3 = 0 then
|
||||
Put_Line("Fizz");
|
||||
else
|
||||
Put_Line(Integer'Image(I));
|
||||
end if;
|
||||
end loop;
|
||||
end Fizzbuzz;
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
loop 1..100 [x][
|
||||
case []
|
||||
when? [0=x%15] -> print "FizzBuzz"
|
||||
when? [0=x%3] -> print "Fizz"
|
||||
when? [0=x%5] -> print "Buzz"
|
||||
else -> print x
|
||||
when [
|
||||
zero? x % 15 -> print "FizzBuzz"
|
||||
zero? x % 3 -> print "Fizz"
|
||||
zero? x % 5 -> print "Buzz"
|
||||
true -> print x
|
||||
]
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
For $i = 1 To 100
|
||||
If Mod($i, 15) = 0 Then
|
||||
MsgBox(0, "FizzBuzz", "FizzBuzz")
|
||||
ElseIf Mod($i, 5) = 0 Then
|
||||
MsgBox(0, "FizzBuzz", "Buzz")
|
||||
ElseIf Mod($i, 3) = 0 Then
|
||||
MsgBox(0, "FizzBuzz", "Fizz")
|
||||
Else
|
||||
MsgBox(0, "FizzBuzz", $i)
|
||||
EndIf
|
||||
Next
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
#include <Constants.au3>
|
||||
|
||||
; uncomment how you want to do the output
|
||||
Func Out($Msg)
|
||||
ConsoleWrite($Msg & @CRLF)
|
||||
|
||||
;~ FileWriteLine("FizzBuzz.Log", $Msg)
|
||||
|
||||
;~ $Btn = MsgBox($MB_OKCANCEL + $MB_ICONINFORMATION, "FizzBuzz", $Msg)
|
||||
;~ If $Btn > 1 Then Exit ; Pressing 'Cancel'-button aborts the program
|
||||
EndFunc ;==>Out
|
||||
|
||||
Out("# FizzBuzz:")
|
||||
For $i = 1 To 100
|
||||
If Mod($i, 15) = 0 Then
|
||||
Out("FizzBuzz")
|
||||
ElseIf Mod($i, 5) = 0 Then
|
||||
Out("Buzz")
|
||||
ElseIf Mod($i, 3) = 0 Then
|
||||
Out("Fizz")
|
||||
Else
|
||||
Out($i)
|
||||
EndIf
|
||||
Next
|
||||
Out("# Done.")
|
||||
|
|
@ -1,26 +1,15 @@
|
|||
(deffacts count
|
||||
(count-to 100)
|
||||
)
|
||||
(count-to 100))
|
||||
|
||||
(defrule print-numbers
|
||||
(count-to ?max)
|
||||
=>
|
||||
(loop-for-count (?num ?max) do
|
||||
(if
|
||||
(= (mod ?num 3) 0)
|
||||
then
|
||||
(printout t "Fizz")
|
||||
)
|
||||
(if
|
||||
(= (mod ?num 5) 0)
|
||||
then
|
||||
(printout t "Buzz")
|
||||
)
|
||||
(if
|
||||
(and (> (mod ?num 3) 0) (> (mod ?num 5) 0))
|
||||
then
|
||||
(printout t ?num)
|
||||
)
|
||||
(priint depth, unsigned int i> struct NUM_DIGITS_CORE : NUM_DIGITS_COREntout t crlf)
|
||||
)
|
||||
)
|
||||
(count-to ?max)
|
||||
=>
|
||||
(loop-for-count (?num ?max) do
|
||||
(if (and (= (mod ?num 3) 0) (= (mod ?num 5) 0) ) then
|
||||
(printout t "FizzBuzz" crlf)
|
||||
else (if (= (mod ?num 3) 0) then
|
||||
(printout t "Fizz" crlf)
|
||||
else (if (= (mod ?num 5) 0) then
|
||||
(printout t "Buzz" crlf)
|
||||
else
|
||||
(printout t ?num crlf))))))
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
* FIZZBUZZ.COB
|
||||
* cobc -x -g FIZZBUZZ.COB
|
||||
*
|
||||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. fizzbuzz.
|
||||
DATA DIVISION.
|
||||
WORKING-STORAGE SECTION.
|
||||
01 CNT PIC 9(03) VALUE 1.
|
||||
01 REM PIC 9(03) VALUE 0.
|
||||
01 QUOTIENT PIC 9(03) VALUE 0.
|
||||
PROCEDURE DIVISION.
|
||||
*
|
||||
PERFORM UNTIL CNT > 100
|
||||
DIVIDE 15 INTO CNT GIVING QUOTIENT REMAINDER REM
|
||||
IF REM = 0
|
||||
THEN
|
||||
DISPLAY "FizzBuzz " WITH NO ADVANCING
|
||||
ELSE
|
||||
DIVIDE 3 INTO CNT GIVING QUOTIENT REMAINDER REM
|
||||
IF REM = 0
|
||||
THEN
|
||||
DISPLAY "Fizz " WITH NO ADVANCING
|
||||
ELSE
|
||||
DIVIDE 5 INTO CNT GIVING QUOTIENT REMAINDER REM
|
||||
IF REM = 0
|
||||
THEN
|
||||
DISPLAY "Buzz " WITH NO ADVANCING
|
||||
ELSE
|
||||
DISPLAY CNT " " WITH NO ADVANCING
|
||||
END-IF
|
||||
END-IF
|
||||
END-IF
|
||||
ADD 1 TO CNT
|
||||
END-PERFORM
|
||||
DISPLAY ""
|
||||
STOP RUN.
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
Identification division.
|
||||
Program-id. fizz-buzz.
|
||||
|
||||
Data division.
|
||||
Working-storage section.
|
||||
|
||||
01 num pic 999.
|
||||
|
||||
Procedure division.
|
||||
Perform varying num from 1 by 1 until num > 100
|
||||
if function mod (num, 15) = 0 then display "fizzbuzz"
|
||||
else if function mod (num, 3) = 0 then display "fizz"
|
||||
else if function mod (num, 5) = 0 then display "buzz"
|
||||
else display num
|
||||
end-perform.
|
||||
Stop run.
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. FIZZBUZZ.
|
||||
ENVIRONMENT DIVISION.
|
||||
DATA DIVISION.
|
||||
WORKING-STORAGE SECTION.
|
||||
01 X PIC 999.
|
||||
01 Y PIC 999.
|
||||
01 REM3 PIC 999.
|
||||
01 REM5 PIC 999.
|
||||
PROCEDURE DIVISION.
|
||||
PERFORM VARYING X FROM 1 BY 1 UNTIL X > 100
|
||||
DIVIDE X BY 3 GIVING Y REMAINDER REM3
|
||||
DIVIDE X BY 5 GIVING Y REMAINDER REM5
|
||||
EVALUATE REM3 ALSO REM5
|
||||
WHEN ZERO ALSO ZERO
|
||||
DISPLAY "FizzBuzz"
|
||||
WHEN ZERO ALSO ANY
|
||||
DISPLAY "Fizz"
|
||||
WHEN ANY ALSO ZERO
|
||||
DISPLAY "Buzz"
|
||||
WHEN OTHER
|
||||
DISPLAY X
|
||||
END-EVALUATE
|
||||
END-PERFORM
|
||||
STOP RUN
|
||||
.
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
>>SOURCE FORMAT FREE
|
||||
identification division.
|
||||
program-id. fizzbuzz.
|
||||
data division.
|
||||
working-storage section.
|
||||
01 i pic 999.
|
||||
01 fizz pic 999 value 3.
|
||||
01 buzz pic 999 value 5.
|
||||
procedure division.
|
||||
start-fizzbuzz.
|
||||
perform varying i from 1 by 1 until i > 100
|
||||
evaluate i also i
|
||||
when fizz also buzz
|
||||
display 'fizzbuzz'
|
||||
add 3 to fizz
|
||||
add 5 to buzz
|
||||
when fizz also any
|
||||
display 'fizz'
|
||||
add 3 to fizz
|
||||
when buzz also any
|
||||
display 'buzz'
|
||||
add 5 to buzz
|
||||
when other
|
||||
display i
|
||||
end-evaluate
|
||||
end-perform
|
||||
stop run
|
||||
.
|
||||
end program fizzbuzz.
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
proc fizzbuzz(n) {
|
||||
for i in 1..n do
|
||||
if i % 15 == 0 then
|
||||
writeln("FizzBuzz");
|
||||
else if i % 5 == 0 then
|
||||
writeln("Buzz");
|
||||
else if i % 3 == 0 then
|
||||
writeln("Fizz");
|
||||
else
|
||||
writeln(i);
|
||||
}
|
||||
|
||||
fizzbuzz(100);
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
Require Import Coq.Lists.List.
|
||||
(* https://coq.inria.fr/library/Coq.Lists.List.html *)
|
||||
|
||||
Require Import Coq.Strings.String.
|
||||
(* https://coq.inria.fr/library/Coq.Strings.String.html *)
|
||||
|
||||
Require Import Coq.Strings.Ascii.
|
||||
(* https://coq.inria.fr/library/Coq.Strings.Ascii.html *)
|
||||
|
||||
Require Import Coq.Init.Nat.
|
||||
(* https://coq.inria.fr/library/Coq.Init.Nat.html *)
|
||||
|
||||
|
||||
(** Definition of [string_of_nat] to convert natural numbers to strings. *)
|
||||
|
||||
Definition ascii_of_digit (n : nat) : ascii :=
|
||||
ascii_of_nat (n + 48).
|
||||
|
||||
Definition is_digit (n : nat) : bool :=
|
||||
andb (0 <=? n) (n <=? 9).
|
||||
|
||||
Fixpoint rec_string_of_nat (counter : nat) (n : nat) (acc : string) : string :=
|
||||
match counter with
|
||||
| 0 => EmptyString
|
||||
| S c =>
|
||||
if (is_digit n)
|
||||
then String (ascii_of_digit n) acc
|
||||
else rec_string_of_nat c (n / 10) (String (ascii_of_digit (n mod 10)) acc)
|
||||
end.
|
||||
(** The counter is only used to ensure termination. *)
|
||||
|
||||
Definition string_of_nat (n : nat) : string :=
|
||||
rec_string_of_nat n n EmptyString.
|
||||
|
||||
|
||||
(** The FizzBuzz problem. *)
|
||||
|
||||
Definition fizz : string :=
|
||||
"Fizz".
|
||||
|
||||
Definition buzz : string :=
|
||||
"Buzz".
|
||||
|
||||
Definition new_line : string :=
|
||||
String (ascii_of_nat 10) EmptyString.
|
||||
|
||||
Definition is_divisible_by (n : nat) (k : nat) : bool :=
|
||||
(n mod k) =? 0.
|
||||
|
||||
Definition get_term (n : nat) : string :=
|
||||
if (is_divisible_by n 15) then fizz ++ buzz
|
||||
else if (is_divisible_by n 3) then fizz
|
||||
else if (is_divisible_by n 5) then buzz
|
||||
else (string_of_nat n).
|
||||
|
||||
Definition range (a : nat) (b : nat) : list nat :=
|
||||
seq a b.
|
||||
|
||||
Definition get_terms (n : nat) : list string :=
|
||||
map get_term (range 1 n).
|
||||
|
||||
Definition fizz_buzz : string :=
|
||||
concat new_line (get_terms 100).
|
||||
|
||||
(** This shows the string. *)
|
||||
Eval compute in fizz_buzz.
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
(defun fizzbuzz (n)
|
||||
(cond ((and (zerop (% n 5)) (zerop (% n 3))) "FizzBuzz")
|
||||
((zerop (% n 3)) "Fizz")
|
||||
((zerop (% n 5)) "Buzz")
|
||||
(t n)))
|
||||
|
||||
;; loop & print from 0 to 100
|
||||
(dotimes (i 101)
|
||||
(message "%s" (fizzbuzz i)))
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
include std/utils.e
|
||||
|
||||
function fb( atom n )
|
||||
sequence fb
|
||||
if remainder( n, 15 ) = 0 then
|
||||
fb = "FizzBuzz"
|
||||
elsif remainder( n, 5 ) = 0 then
|
||||
fb = "Fizz"
|
||||
elsif remainder( n, 3 ) = 0 then
|
||||
fb = "Buzz"
|
||||
else
|
||||
fb = sprintf( "%d", n )
|
||||
end if
|
||||
return fb
|
||||
end function
|
||||
|
||||
function fb2( atom n )
|
||||
return iif( remainder(n, 15) = 0, "FizzBuzz",
|
||||
iif( remainder( n, 5 ) = 0, "Fizz",
|
||||
iif( remainder( n, 3) = 0, "Buzz", sprintf( "%d", n ) ) ) )
|
||||
end function
|
||||
|
||||
for i = 1 to 30 do
|
||||
printf( 1, "%s ", { fb( i ) } )
|
||||
end for
|
||||
|
||||
puts( 1, "\n" )
|
||||
|
||||
for i = 1 to 30 do
|
||||
printf( 1, "%s ", { fb2( i ) } )
|
||||
end for
|
||||
|
||||
puts( 1, "\n" )
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
USE: math.parser
|
||||
1 101 [ [ 3 5 [ mod 0 = ] bi-curry@ bi "Fizz" "Buzz" swapd [ and ] 2bi@ append ] keep number>string or print ] each-integer-from
|
||||
100 [1..b] [ { "Fizz" "Buzz" } { 3 5 } [ overd mod 0 = swap and ] 2map concat swap >dec or print ] each
|
||||
|
|
|
|||
|
|
@ -1,36 +1 @@
|
|||
i.10
|
||||
0 1 2 3 4 5 6 7 8 9
|
||||
(3 5 |/ ])i.10
|
||||
0 1 2 0 1 2 0 1 2 0
|
||||
0 1 2 3 4 0 1 2 3 4
|
||||
(0=3 5 |/ ])i.10
|
||||
1 0 0 1 0 0 1 0 0 1
|
||||
1 0 0 0 0 1 0 0 0 0
|
||||
(;:'Fizz Buzz')
|
||||
┌────┬────┐
|
||||
│Fizz│Buzz│
|
||||
└────┴────┘
|
||||
((;:'Fizz Buzz') #&.>~0=3 5 |/ ])i.10
|
||||
┌────┬┬┬────┬┬────┬────┬┬┬────┐
|
||||
│Fizz│││Fizz││ │Fizz│││Fizz│
|
||||
├────┼┼┼────┼┼────┼────┼┼┼────┤
|
||||
│Buzz│││ ││Buzz│ │││ │
|
||||
└────┴┴┴────┴┴────┴────┴┴┴────┘
|
||||
([: ,&.>/ (;:'Fizz Buzz') #&.>~0=3 5 |/ ])i.10
|
||||
┌────────┬┬┬────┬┬────┬────┬┬┬────┐
|
||||
│FizzBuzz│││Fizz││Buzz│Fizz│││Fizz│
|
||||
└────────┴┴┴────┴┴────┴────┴┴┴────┘
|
||||
(":&.>)i.10
|
||||
┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
|
||||
│0│1│2│3│4│5│6│7│8│9│
|
||||
└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘
|
||||
(":&.> [^:(0 = #@])&.> [: ,&.>/ (;:'Fizz Buzz') #&.>~0=3 5 |/ ])i.10
|
||||
┌────────┬─┬─┬────┬─┬────┬────┬─┬─┬────┐
|
||||
│FizzBuzz│1│2│Fizz│4│Buzz│Fizz│7│8│Fizz│
|
||||
└────────┴─┴─┴────┴─┴────┴────┴─┴─┴────┘
|
||||
}.(":&.> [^:(0 = #@])&.> [: ,&.>/ (;:'Fizz Buzz') #&.>~0=3 5 |/ ])i.10
|
||||
┌─┬─┬────┬─┬────┬────┬─┬─┬────┐
|
||||
│1│2│Fizz│4│Buzz│Fizz│7│8│Fizz│
|
||||
└─┴─┴────┴─┴────┴────┴─┴─┴────┘
|
||||
;:inv}.(":&.> [^:(0 = #@])&.> [: ,&.>/ (;:'Fizz Buzz') #&.>~0=3 5 |/ ])i.10
|
||||
1 2 Fizz 4 Buzz Fizz 7 8 Fizz
|
||||
{{>(#.|:0=3 5|&><L)}(":&.>L=.1+i.y),|:(y,3)$;:'Fizz Buzz FizzBuzz'}}100
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
>((2#.3 q:15&+.){(|.(;~,&;);:'Fizz Buzz');~":)&>1+i.100
|
||||
((+:/,])@(0=3 5&|);@#Fizz`Buzz;~":)"0>:i.100
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
":`('Fizz'"_)`('Buzz'"_)`('FizzBuzz'"_)@.(2#.0=5 3&|)"0>:i.100
|
||||
>((2#.0=5 3|]){Fizz`Buzz`FizzBuzz;~":)&>1+i.100
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
> }. (<'FizzBuzz') (I.0=15|n)} (<'Buzz') (I.0=5|n)} (<'Fizz') (I.0=3|n)} ":&.> n=: i.101
|
||||
>((2#.3 q:15&+.){(|.(;~;);:'Fizz Buzz');~":)&>1+i.100
|
||||
|
|
|
|||
|
|
@ -1,5 +1 @@
|
|||
Fizz=: 'Fizz' #~ 0 = 3&|
|
||||
Buzz=: 'Buzz' #~ 0 = 5&|
|
||||
FizzBuzz=: ": [^:('' -: ]) Fizz,Buzz
|
||||
|
||||
FizzBuzz"0 >: i.100
|
||||
":`('Fizz'"_)`('Buzz'"_)`('FizzBuzz'"_)@.(2#.0=5 3&|)"0>:i.100
|
||||
|
|
|
|||
|
|
@ -1,6 +1 @@
|
|||
CRT0=: 2 : ' (, 0 = +./)@(0 = m | ]) ;@# n , <@": '
|
||||
NB. Rather (, 0 = +./) than (, +:/) because designed for
|
||||
NB. 3 5 7 CRT0 (;:'Chinese Remainder Period') "0 >: i. */3 5 7
|
||||
FizzBuzz=: 3 5 CRT0 (;:'Fizz Buzz')
|
||||
|
||||
FizzBuzz"0 >: i.100
|
||||
> }. (<'FizzBuzz') (I.0=15|n)} (<'Buzz') (I.0=5|n)} (<'Fizz') (I.0=3|n)} ":&.> n=: i.101
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
'`f b fb' =: ('Fizz'"_) ` ('Buzz'"_) ` (f , b)
|
||||
'`cm3 cm5 cm15'=: (3&|) ` (5&|) ` (15&|) (0&=@)
|
||||
FizzBuzz=: ": ` f @. cm3 ` b @. cm5 ` fb @. cm15 NB. also:
|
||||
FizzBuzz=: ": ` f @. cm3 ` b @. cm5 ` (f,b) @. (cm3 *. cm5)
|
||||
Fizz=: 'Fizz' #~ 0 = 3&|
|
||||
Buzz=: 'Buzz' #~ 0 = 5&|
|
||||
FizzBuzz=: ": [^:('' -: ]) Fizz,Buzz
|
||||
|
||||
FizzBuzz"0 >: i.100
|
||||
|
|
|
|||
|
|
@ -1 +1,6 @@
|
|||
{{>(#.|:0=3 5|&><L)}(":&.>L=.1+i.y),|:(y,3)$;:'Fizz Buzz FizzBuzz'}}100
|
||||
CRT0=: 2 : ' (, 0 = +./)@(0 = m | ]) ;@# n , <@": '
|
||||
NB. Rather (, 0 = +./) than (, +:/) because designed for
|
||||
NB. 3 5 7 CRT0 (;:'Chinese Remainder Period') "0 >: i. */3 5 7
|
||||
FizzBuzz=: 3 5 CRT0 (;:'Fizz Buzz')
|
||||
|
||||
FizzBuzz"0 >: i.100
|
||||
|
|
|
|||
|
|
@ -1,2 +1,6 @@
|
|||
;:inv}.(":&.> [^:(0 = #@])&.> [: ,&.>/ ;:@'Fizz Buzz' #&.>~ 0=3 5|/])i.101
|
||||
1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz 16 17 Fizz 19 Buzz Fizz 22 23 Fizz Buzz 26 Fizz 28 29 FizzBuzz 31 32 Fizz 34 Buzz Fizz 37 38 Fizz Buzz 41 Fizz 43 44 FizzBuzz 46 47 Fizz 49 Buzz Fizz 52 53 Fizz Buzz 56 Fizz 58 59 FizzBuzz 61 62 Fiz...
|
||||
'`f b fb' =: ('Fizz'"_) ` ('Buzz'"_) ` (f , b)
|
||||
'`cm3 cm5 cm15'=: (3&|) ` (5&|) ` (15&|) (0&=@)
|
||||
FizzBuzz=: ": ` f @. cm3 ` b @. cm5 ` fb @. cm15 NB. also:
|
||||
FizzBuzz=: ": ` f @. cm3 ` b @. cm5 ` (f,b) @. (cm3 *. cm5)
|
||||
|
||||
FizzBuzz"0 >: i.100
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
for ($i = 1; $i -le 100; $i++) {
|
||||
if ($i % 15 -eq 0) {
|
||||
"FizzBuzz"
|
||||
} elseif ($i % 5 -eq 0) {
|
||||
"Buzz"
|
||||
} elseif ($i % 3 -eq 0) {
|
||||
"Fizz"
|
||||
} else {
|
||||
$i
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
$txt=$null
|
||||
1..100 | ForEach-Object {
|
||||
switch ($_) {
|
||||
{ $_ % 3 -eq 0 } { $txt+="Fizz" }
|
||||
{ $_ % 5 -eq 0 } { $txt+="Buzz" }
|
||||
$_ { if($txt) { $txt } else { $_ }; $txt=$null }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
1..100 | ForEach-Object {
|
||||
$s = ''
|
||||
if ($_ % 3 -eq 0) { $s += "Fizz" }
|
||||
if ($_ % 5 -eq 0) { $s += "Buzz" }
|
||||
if (-not $s) { $s = $_ }
|
||||
$s
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
1..100 | % {write-host("$(if(($_ % 3 -ne 0) -and ($_ % 5 -ne 0)){$_})$(if($_ % 3 -eq 0){"Fizz"})$(if($_ % 5 -eq 0){"Buzz"})")}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
filter fizz-buzz{
|
||||
@(
|
||||
$_,
|
||||
"Fizz",
|
||||
"Buzz",
|
||||
"FizzBuzz"
|
||||
)[
|
||||
2 *
|
||||
($_ -match '[05]$') +
|
||||
($_ -match '(^([369][0369]?|[258][147]|[147][258]))$')
|
||||
]
|
||||
}
|
||||
|
||||
1..100 | fizz-buzz
|
||||
|
|
@ -1 +0,0 @@
|
|||
(1..100 -join "`n") + "`nFizzBuzz" -replace '(?ms)(^([369]([369]|(?=0|$))|[258][147]|[147]([28]|(?=5))))(?=[05]?$.*(Fizz))|(((?<=[369])|[^369])0+|((?<=[147\s])|[^147\s])5)(?=$.*(Buzz))|FizzBuzz', '$5$9'
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
REBOL [
|
||||
Title: "FizzBuzz"
|
||||
URL: http://rosettacode.org/wiki/FizzBuzz
|
||||
]
|
||||
|
||||
; Concatenative. Note use of 'case/all' construct to evaluate all
|
||||
; conditions. I use 'copy' to allocate a new string each time through
|
||||
; the loop -- otherwise 'x' would get very long...
|
||||
|
||||
repeat i 100 [
|
||||
x: copy ""
|
||||
case/all [
|
||||
0 = mod i 3 [append x "Fizz"]
|
||||
0 = mod i 5 [append x "Buzz"]
|
||||
"" = x [x: mold i]
|
||||
]
|
||||
print x
|
||||
]
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
repeat i 100 [
|
||||
print switch/default 0 compose [
|
||||
(mod i 15) ["fizzbuzz"]
|
||||
(mod i 3) ["fizz"]
|
||||
(mod i 5) ["buzz"]
|
||||
][i]
|
||||
]
|
||||
|
|
@ -1 +0,0 @@
|
|||
repeat i 100[j:""if i // 3 = 0[j:"fizz"]if i // 5 = 0[j: join j"buzz"]if""= j[j: i]print j]
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
m: func [i d] [0 = mod i d]
|
||||
spick: func [t x y][either any [not t "" = t][y][x]]
|
||||
zz: func [i] [rejoin [spick m i 3 "Fizz" "" spick m i 5 "Buzz" ""]]
|
||||
repeat i 100 [print spick z: zz i z i]
|
||||
|
|
@ -1 +1 @@
|
|||
⨬(&p|&p"Fizz"|&p"Buzz"|&p"Fizzbuzz")°⋯⍉=0⊞◿3_5.+1⇡100
|
||||
⨬(&p|&p"Fizz"|&p"Buzz"|&p"Fizzbuzz")°⋯⍉=0⊸⊞◿3_5+1⇡100
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
For i = 1 To 100
|
||||
If i Mod 15 = 0 Then
|
||||
WScript.Echo "FizzBuzz"
|
||||
ElseIf i Mod 5 = 0 Then
|
||||
WScript.Echo "Buzz"
|
||||
ElseIf i Mod 3 = 0 Then
|
||||
WScript.Echo "Fizz"
|
||||
Else
|
||||
WScript.Echo i
|
||||
End If
|
||||
Next
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
With WScript.StdOut
|
||||
For i = 1 To 100
|
||||
If i Mod 3 = 0 Then .Write "Fizz"
|
||||
If i Mod 5 = 0 Then .Write "Buzz"
|
||||
If .Column = 1 Then .WriteLine i Else .WriteLine ""
|
||||
Next
|
||||
End With
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
entity fizzbuzz is
|
||||
end entity fizzbuzz;
|
||||
|
||||
architecture beh of fizzbuzz is
|
||||
|
||||
procedure fizzbuzz(num : natural) is
|
||||
begin
|
||||
if num mod 15 = 0 then
|
||||
report "FIZZBUZZ";
|
||||
elsif num mod 3 = 0 then
|
||||
report "FIZZ";
|
||||
elsif num mod 5 = 0 then
|
||||
report "BUZZ";
|
||||
else
|
||||
report to_string(num);
|
||||
end if;
|
||||
end procedure fizzbuzz;
|
||||
|
||||
begin
|
||||
|
||||
p_fizz : process is
|
||||
begin
|
||||
for i in 1 to 100 loop
|
||||
fizzbuzz(i);
|
||||
end loop;
|
||||
wait for 200 us;
|
||||
end process p_fizz;
|
||||
|
||||
end architecture beh;
|
||||
Loading…
Add table
Add a link
Reference in a new issue