Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
24
Task/General-FizzBuzz/MiniScript/general-fizzbuzz.mini
Normal file
24
Task/General-FizzBuzz/MiniScript/general-fizzbuzz.mini
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
factorWords = {}
|
||||
|
||||
maxNr = val(input("Max number? "))
|
||||
|
||||
while true
|
||||
factorInput = input("Factor? ")
|
||||
if factorInput == "" then break
|
||||
// Split input
|
||||
parts = factorInput.split(" ")
|
||||
factor = val(parts[0])
|
||||
word = parts[1]
|
||||
// Assign factor/word
|
||||
factorWords[factor] = word
|
||||
end while
|
||||
|
||||
for nr in range(1,maxNr)
|
||||
matchingWords = ""
|
||||
for factor in factorWords.indexes
|
||||
if nr % factor == 0 then
|
||||
matchingWords = matchingWords + factorWords[factor]
|
||||
end if
|
||||
end for
|
||||
if matchingWords then print matchingWords else print nr
|
||||
end for
|
||||
Loading…
Add table
Add a link
Reference in a new issue