>> মঙ্গলবার, ১৭ নভেম্বর, ২০০৯
The first line of a input file is an integer N, then a blank line followed by N input blocks. The first line of an each input block contains a single number M (1<=M<=1000000) — the length of the integers (in order to make their lengths equal, some leading zeroes can be added). It is followed by these integers written in columns. That is, the next M lines contain two digits each, divided by a space. Each of the two given integers is not less than 1, and the length of their sum does not exceed M.There is a blank line between input blocks.
The OutputEach output block should contain exactly M digits in a single line representing the sum of these two integers.There is a blank line between output blocks.
Sample Input2 4 0 4 4 2 6 8 3 7 3 3 0 7 9 2 8
Discussion: presented by rizoan toufiq
- Need a & b character type array. Because the value of the array not more than 9.
- Must print the last carry & be careful to print last newline
- Each case: take input from 1 no array index. so that you can put last carry in 0 index.
- For example:AB so here last index=4Add:I=4, (a+b)%10+carry[initially it zero]=0 =reault[4=i]Carry=(a+b)/10I=3,similarly, result[i]=8 carry=0I=2 ,similarly result[i]=7 carry=0I=1,similarly result[i]=1 carry=1I=0 ,result[i]=carry*** I think it is helped you
DOWNLOAD DOCUMENT FILE :