Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def additionWithoutCarrying(param1, param2)
- result = 0
- ten_power = 1
- while (param1 > 0 or param2 > 0)
- result = result + ten_power * ((param1 + param2) % 10)
- param1 /= 10
- param2 /= 10
- ten_power = ten_power * 10
- end
- return result
- end
Advertisement
Add Comment
Please, Sign In to add comment