Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -0,0 +1,16 @@
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;

View file

@ -0,0 +1,11 @@
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

View file

@ -0,0 +1,25 @@
#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.")

View file

@ -0,0 +1,16 @@
// https://rosettacode.org/wiki/FizzBuzz
import ballerina/io;
public function main() {
foreach int i in int:range(1,101,1) {
if i % 15 == 0 {
io:println("FizzBuzz");
} else if i % 5 == 0 {
io:println("Buzz");
} else if i % 3 == 0 {
io:println("Fizz");
} else {
io:println(i);
}
}
}

View file

@ -0,0 +1,8 @@
@echo off
setlocal enableextensions enabledelayedexpansion
for /L %%i in (1,1,100) do (
set /a "fizz=%%i%%3, buzz=%%i%%5, fizzbuzz=fizz+buzz" %= or fizzbuzz=%%i%%15 =%
if "!fizzbuzz!"=="0" (echo FizzBuzz
) else (if "!fizz!"=="0" (echo Fizz
) else (if "!buzz!"=="0" (echo Buzz) else (echo %%i)))
)

View file

@ -0,0 +1,36 @@
* 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.

View file

@ -0,0 +1,16 @@
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.

View file

@ -0,0 +1,26 @@
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
.

View file

@ -0,0 +1,29 @@
>>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.

View file

@ -0,0 +1,13 @@
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);

View file

@ -1,7 +1,7 @@
logic isFizz, isBuzz
for int count = 1; count <= 100; ++count
isFizz = count % 3 == 0
isBuzz = count % 5 == 0
for int count ← 1; count ≤ 100; ++count
isFizz ← count % 3 æ 0
isBuzz ← count % 5 æ 0
if isFizz and isBuzz do writeLine("Fizz Buzz")
else if isFizz do writeLine("Fizz")
else if isBuzz do writeLine("Buzz")

View file

@ -1,11 +1,11 @@
for i = 1 to 100
if i mod 15 = 0
print "FizzBuzz"
elif i mod 5 = 0
print "Buzz"
elif i mod 3 = 0
print "Fizz"
else
print i
.
if i mod 15 = 0
print "FizzBuzz"
elif i mod 5 = 0
print "Buzz"
elif i mod 3 = 0
print "Fizz"
else
print i
.
.

View file

@ -0,0 +1,9 @@
(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)))

View file

@ -0,0 +1,33 @@
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" )

View file

@ -0,0 +1,4 @@
: | >r >r dup r> mod 0= if r> count type drop then r> drop ;
: fizzbuzz1 15 c" FizzBuzz " | 3 c" Fizz " | 5 c" Buzz " | . ;
: fizzbuzz 101 1 do i fizzbuzz1 loop ;
fizzbuzz

View file

@ -1,19 +1,18 @@
import gleam/int
import gleam/io
import gleam/yielder
import gleam/list
pub fn main() {
yielder.range(1, 101)
|> yielder.map(to_fizzbuzz)
|> yielder.map(io.println)
|> yielder.run
int.range(100, 0, [], list.prepend)
|> list.map(fizz_buzz)
|> list.each(io.println)
}
fn to_fizzbuzz(n: Int) -> String {
case n % 3, n % 5 {
pub fn fizz_buzz(i) {
case i % 3, i % 5 {
0, 0 -> "FizzBuzz"
0, _ -> "Fizz"
_, 0 -> "Buzz"
_, _ -> int.to_string(n)
_, _ -> int.to_string(i)
}
}

View file

@ -0,0 +1,2 @@
;: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...

View file

@ -0,0 +1,36 @@
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

View file

@ -0,0 +1,3 @@
100.map{ it + 1 }
.map{ [it, (it % 5 == 0 ? 'Fizz' : '') + (it % 3 == 0 ? 'Buzz' : '')] }
.each{ println it[1] ? it[1] : it[0] }

View file

@ -0,0 +1,11 @@
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
}
}

View file

@ -0,0 +1,8 @@
$txt=$null
1..100 | ForEach-Object {
switch ($_) {
{ $_ % 3 -eq 0 } { $txt+="Fizz" }
{ $_ % 5 -eq 0 } { $txt+="Buzz" }
$_ { if($txt) { $txt } else { $_ }; $txt=$null }
}
}

View file

@ -0,0 +1,7 @@
1..100 | ForEach-Object {
$s = ''
if ($_ % 3 -eq 0) { $s += "Fizz" }
if ($_ % 5 -eq 0) { $s += "Buzz" }
if (-not $s) { $s = $_ }
$s
}

View file

@ -0,0 +1 @@
1..100 | % {write-host("$(if(($_ % 3 -ne 0) -and ($_ % 5 -ne 0)){$_})$(if($_ % 3 -eq 0){"Fizz"})$(if($_ % 5 -eq 0){"Buzz"})")}

View file

@ -0,0 +1,14 @@
filter fizz-buzz{
@(
$_,
"Fizz",
"Buzz",
"FizzBuzz"
)[
2 *
($_ -match '[05]$') +
($_ -match '(^([369][0369]?|[258][147]|[147][258]))$')
]
}
1..100 | fizz-buzz

View file

@ -0,0 +1 @@
(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'

View file

@ -0,0 +1,97 @@
# riscv assembly raspberry pico2 rp2350
# program fizzbuzz.s
# connexion putty com3
/*********************************************/
/* CONSTANTES */
/********************************************/
/* for this file see risc-v task include a file */
.include "../../../constantesRiscv.inc"
/****************************************************/
/* MACROS */
/****************************************************/
#.include "../ficmacrosriscv.inc" # only for debugging
/*******************************************/
/* INITIALED DATAS */
/*******************************************/
.data
szMessStart: .asciz "Program riscv start.\r\n"
szMessEndOk: .asciz "Program riscv end OK.\r\n"
szCariageReturn: .asciz "\r\n"
szMessFizz: .asciz " Fizz\n"
szMessBuzz: .asciz " Buzz\n"
szMessFizzBuzz: .asciz " FizzBuzz\n"
.align 2
/*******************************************/
/* UNINITIALED DATA */
/*******************************************/
.bss
sConvArea: .skip 24
.align 2
/**********************************************/
/* SECTION CODE */
/**********************************************/
.text
.global main
main:
call stdio_init_all # général init
1: # start loop connexion
li a0,0 # raz argument register
call tud_cdc_n_connected # waiting for USB connection
beqz a0,1b # return code = zero ? yes -> loop
la a0,szMessStart # message address
call writeString # display message
li s0,0 # loop indice
li s1,3 # divisor 3
li s2,5 # divisor 5
li s3,15 # divisor 15
li s4,100
1:
remu t0,s0,s3 # / by 15
bnez t0,2f
la s5,szMessFizzBuzz
j 4f
2:
remu t0,s0,s2 # / by 5
bnez t0,3f
la s5,szMessBuzz
j 4f
3:
remu t0,s0,s1 # / by 3
bnez t0,5f
la s5,szMessFizz
j 4f
4:
mv a0,s0
la a1,sConvArea
call conversion10 # conversion decimal
la a0,sConvArea
call writeString
#la a0,szCariageReturn
#call writeString
mv a0,s5
call writeString # display message
5:
addi s0,s0,1
ble s0,s4,1b
la a0,szMessEndOk # message address
call writeString # display message
call getchar
100: # final loop
j 100b
/************************************/
/* file include Fonctions */
/***********************************/
/* for this file see risc-v task include a file */
.include "../../../includeFunctions.s"

View file

@ -0,0 +1,18 @@
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
]

View file

@ -0,0 +1,7 @@
repeat i 100 [
print switch/default 0 compose [
(mod i 15) ["fizzbuzz"]
(mod i 3) ["fizz"]
(mod i 5) ["buzz"]
][i]
]

View file

@ -0,0 +1 @@
repeat i 100[j:""if i // 3 = 0[j:"fizz"]if i // 5 = 0[j: join j"buzz"]if""= j[j: i]print j]

View file

@ -0,0 +1,4 @@
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]

View file

@ -0,0 +1,66 @@
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.

View file

@ -0,0 +1,13 @@
declare integer i%
for i% = 1 to 100
if i% mod 15 = 0 then
print 'FizzBuzz'
elseif i% mod 3 = 0 then
print 'Fizz'
elseif i% mod 5 = 0 then
print 'Buzz'
else
print i%
end if
next i%

View file

@ -0,0 +1,11 @@
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

View file

@ -0,0 +1,7 @@
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

View file

@ -0,0 +1,29 @@
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;