result
to store the final array-form of the sum.carry
to 0, which will hold the carry-over value during addition.num
from the last element to the first, simultaneously reducing k
by taking its modulo 10.num
, the last digit of k
, and carry
.carry
to be the sum divided by 10.result
.k
by dividing it by 10 to remove the last digit.num
are processed.k
is still greater than 0, process the remaining digits of k
.result
.result
to get the correct order of digits.result
.