Anonymous user
Ethiopian multiplication: Difference between revisions
→{{header|MATLAB}}: Optimized and commented the code
(→{{header|MATLAB}}: Optimized and commented the code) |
|||
Line 986:
=={{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. To see how this function operates, remove the semi-colons.
<lang matlab>function
%Generate columns
while
end
%Strike out appropriate rows
A=sum(b);</lang>▼
multiplier( find( mod(multiplicand,2)==0 ) ) = [];
%Generate answer
answer = sum(multiplier);
=={{header|MMIX}}==
|