Number carries | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Number carries

Two integer numbers are added using the column addition method. When using this method, some additions of digits produce non-zero carries to the next positions. Your task is to calculate the number of non-zero carries that will occur while adding the given numbers. The numbers are added in base 10. Here is my code. I want to make the len(a) the last digit of a. And it gives some back an error... Please help me with how to fix it if possible!!! THANK U

2nd Jun 2021, 2:48 AM
Ailana
Ailana - avatar
3 Answers
+ 4
Where is the code?
2nd Jun 2021, 3:33 AM
Genuine Stalwart
Genuine Stalwart - avatar
+ 2
say a is 12345. the last digit 5 is a%10 while 1234 is a//10
2nd Jun 2021, 6:09 AM
Oma Falk
Oma Falk - avatar
0
...nvm
3rd Jun 2021, 11:38 PM
Ailana
Ailana - avatar