Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
|
|
@ -0,0 +1,28 @@
|
|||
public function boolean wf_iseven (long al_arg);return mod(al_arg, 2 ) = 0
|
||||
end function
|
||||
|
||||
public function long wf_halve (long al_arg);RETURN int(al_arg / 2)
|
||||
end function
|
||||
|
||||
public function long wf_double (long al_arg);RETURN al_arg * 2
|
||||
end function
|
||||
|
||||
public function long wf_ethiopianmultiplication (long al_multiplicand, long al_multiplier);// calculate result
|
||||
long ll_product
|
||||
|
||||
DO WHILE al_multiplicand >= 1
|
||||
IF wf_iseven(al_multiplicand) THEN
|
||||
// do nothing
|
||||
ELSE
|
||||
ll_product += al_multiplier
|
||||
END IF
|
||||
al_multiplicand = wf_halve(al_multiplicand)
|
||||
al_multiplier = wf_double(al_multiplier)
|
||||
LOOP
|
||||
|
||||
return ll_product
|
||||
end function
|
||||
|
||||
// example call
|
||||
long ll_answer
|
||||
ll_answer = wf_ethiopianmultiplication(17,34)
|
||||
Loading…
Add table
Add a link
Reference in a new issue