+ 1

Using strings to add together large integers

please help with adding large ints with this method and with displaying the result. Thank you

13th Feb 2018, 12:48 PM
Mich
Mich - avatar
3 ответов
+ 2
Try something like: sum[i] = 48 + (((a[i] - 48) + (b[i] - 48)+ carry_over) %10); if (((a[i] - 48) + (b[i] - 48) + carry_over) >= 10) carry_over = 1; else carry_over = 0;
13th Feb 2018, 2:02 PM
Vlad Serbu
Vlad Serbu - avatar
+ 2
48 is the character value of '0' (49 of '1', 50 of '2' and so on)
13th Feb 2018, 2:02 PM
Vlad Serbu
Vlad Serbu - avatar
0
Thank you very much
13th Feb 2018, 10:11 PM
Mich
Mich - avatar