Long multiplication: Difference between revisions

Updated to work with Nim 1.4: added parameter type, replaced "repeatChar" by "repeat", removed unused variables.
(Added Delphi example)
(Updated to work with Nim 1.4: added parameter type, replaced "repeatChar" by "repeat", removed unused variables.)
Line 3,808:
<lang nim>import strutils
 
proc ti(a: char): int = ord(a) - ord('0')
 
proc longmulti(a, b: string): string =
var
i, j, n, carry, la, lb = 0
k = false
 
Line 3,831:
return
 
result = repeatCharrepeat('0', a.len + b.len, '0')
 
for i in countdown(a.high, 0):
Anonymous user