if array contain value in 2 or 3 digits like 22,34,445 like this then in what manner i should add them
I should store 1 digits and pass remaining digits as carry or what?
like this i should do or not 22+330=352 so 2 will store and 35 is used as carry
Values in array
@n.nishchaya2000 you dont need all of the remaining array. just add the current digits. store their sum as the value of sum and if it’s more than 9, then the remaining part as carry. then move on to the next digits.
for eg if number is 19 and 23
then
you add 9 + 3, so sum = 12
store sum % 10, ie 2 as the “sum” for that digits and carry becomes sum/10, ie 1
now when you move to the left,
add 1 + 2 + 1(carry)
initially you can take carry = 0;
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.