Write an algorithm which multiplies two numbers using the minimum number of additions.
Stat function multiply(firstnum,secondnum):
if secondnum = 0 then
return 0
else
return firstnum + multiply(firstnum, secondnum-1)
end if
Stop
Comments
Leave a comment