Sum of long numbers using a function

closed account (LAM21hU5)
Hi guys,
I am new to programming and I am stuck with a homework which is "write a program which calculates the sum of two numbers too long for long long that uses a function". Please help.
Last edited on
the way I always work with really long numbers is using arrays, and then just add / subtract / multiply like you did in elementary school. I don't know if it's the most efficient method but it always works :P

for example:
26 + 35 = 61
array1[2] = {2,6}
array2[2] = {3,5}
answer[2] = {0,0}

6+5 = 11 => answer[1] = 1, remember 1
2+3 (+1 remembered) = 6 => answer[0] = 6, remember 0

putting that into a function shouldn't be too difficult :)
Topic archived. No new replies allowed.