+ 1
Using strings to add together large integers
please help with adding large ints with this method and with displaying the result. Thank you
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;
+ 2
48 is the character value of '0' (49 of '1', 50 of '2' and so on)
0
Thank you very much