Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
22
Task/General-FizzBuzz/LiveCode/general-fizzbuzz-1.livecode
Normal file
22
Task/General-FizzBuzz/LiveCode/general-fizzbuzz-1.livecode
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
function generalisedFizzBuzz m, f1, f2, f3
|
||||
put f1 & cr & f2 & cr & f3 into factors
|
||||
sort factors ascending numeric
|
||||
repeat with i = 1 to m
|
||||
put false into flag
|
||||
if i mod (word 1 of line 1 of factors) = 0 then
|
||||
put word 2 of line 1 of factors after fizzbuzz
|
||||
put true into flag
|
||||
end if
|
||||
if i mod (word 1 of line 2 of factors) = 0 then
|
||||
put word 2 of line 2 of factors after fizzbuzz
|
||||
put true into flag
|
||||
end if
|
||||
if i mod (word 1 of line 3 of factors) = 0 then
|
||||
put word 2 of line 3 of factors after fizzbuzz
|
||||
put true into flag
|
||||
end if
|
||||
if flag is false then put i after fizzbuzz
|
||||
put cr after fizzbuzz
|
||||
end repeat
|
||||
return fizzbuzz
|
||||
end generalisedFizzBuzz
|
||||
|
|
@ -0,0 +1 @@
|
|||
put generalisedFizzBuzz(20,"7 baxx","3 fizz","5 buzz")
|
||||
Loading…
Add table
Add a link
Reference in a new issue