Ethiopian multiplication: Difference between revisions

(→‎{{header|HicEst}}: Incorrect. It seems that the first END does not match anything?)
Line 941:
 
print(ethiopian(17, 34))</lang>
 
=={{header|MATLAB}}==
 
In order to run this program you need to have MATLAB already installed. Save the program as Ethiopian.m, then into the command prompt type Ethiopian(a,b) where a & b are the two numbers you require to multiply.
 
<lang MATLAB>function A=Ethiopian(a,b)
j=1;
i=1;
while a(i)>1
a(i+1)=floor(a(i)/2);
b(i+1)=b(i)*2;
i=i+1;
end
N=length(a);
for j=1:N
if a(j)/2==floor(a(j)/2)
b(j)=0;
end
end
A=sum(b);</lang>
 
=={{header|MMIX}}==
Anonymous user