|
|
Line 1,740: |
Line 1,740: |
|
end; |
|
end; |
|
/</lang> |
|
/</lang> |
|
|
|
|
|
|
|
⚫ |
=={{header|Powerbuilder}}== |
|
⚫ |
<lang powerbuilder>public function boolean wf_iseven (long al_arg);return mod(al_arg, 2 ) = 0 |
|
⚫ |
|
|
|
|
|
⚫ |
public function long wf_halve (long al_arg);RETURN int(al_arg / 2) |
|
⚫ |
|
|
|
|
|
⚫ |
public function long wf_double (long al_arg);RETURN al_arg * 2 |
|
⚫ |
|
|
|
|
|
⚫ |
public function long wf_ethiopianmultiplication (long al_multiplicand, long al_multiplier);// calculate result |
|
⚫ |
|
|
|
|
|
⚫ |
DO WHILE al_multiplicand >= 1 |
|
⚫ |
IF wf_iseven(al_multiplicand) THEN |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
ll_product += al_multiplier |
|
⚫ |
|
|
⚫ |
al_multiplicand = wf_halve(al_multiplicand) |
|
⚫ |
al_multiplier = wf_double(al_multiplier) |
|
⚫ |
|
|
|
|
|
⚫ |
|
|
⚫ |
|
|
|
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
ll_answer = wf_ethiopianmultiplication(17,34)</lang> |
|
|
|
|
|
|
|
|
=={{header|PowerShell}}== |
|
=={{header|PowerShell}}== |
Line 1,810: |
Line 1,842: |
|
Ethiopian 17 34 |
|
Ethiopian 17 34 |
|
</lang> |
|
</lang> |
|
|
|
⚫ |
=={{header|Powerbuilder}}== |
|
⚫ |
<lang powerbuilder>public function boolean wf_iseven (long al_arg);return mod(al_arg, 2 ) = 0 |
|
⚫ |
|
|
|
|
|
⚫ |
public function long wf_halve (long al_arg);RETURN int(al_arg / 2) |
|
⚫ |
|
|
|
|
|
⚫ |
public function long wf_double (long al_arg);RETURN al_arg * 2 |
|
⚫ |
|
|
|
|
|
⚫ |
public function long wf_ethiopianmultiplication (long al_multiplicand, long al_multiplier);// calculate result |
|
⚫ |
|
|
|
|
|
⚫ |
DO WHILE al_multiplicand >= 1 |
|
⚫ |
IF wf_iseven(al_multiplicand) THEN |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
ll_product += al_multiplier |
|
⚫ |
|
|
⚫ |
al_multiplicand = wf_halve(al_multiplicand) |
|
⚫ |
al_multiplier = wf_double(al_multiplier) |
|
⚫ |
|
|
|
|
|
⚫ |
|
|
⚫ |
|
|
|
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
ll_answer = wf_ethiopianmultiplication(17,34)</lang> |
|
|
|
|
|
|
|
|
|
=={{header|PureBasic}}== |
|
=={{header|PureBasic}}== |