why this is producing wrong output
Sum of two arrays
Bro the logic you have used is not correct, let me help you in building it
Suppose you have input like this:
5
9 9 9 9 9
5
9 9 9 9 9
How will you approach this problem?
We have to do this question in such a manner that every cell of an array doesn’t go beyond number 9, if you will do so you will see
Cell 1 from right 9+9 = 18, 8 in cell . One in carry.
Cell 2 from right 1+9+9 = 19, 9 in cell . One in carry.
Cell 3 from right 1+9+9 = 19, 9 in cell . One in carry.
Cell 4 from right 1+9+9 = 19, 9 in cell . One in carry.
Cell 5 from right 1+9+9 = 19, 19 in cell . Array index ends.
TIP: Try to start your array traversal from the end of the indexes, it will be easy for you 
actually i wanted to implement same thing but i am not able to write correct form.can u please comment out the error in my code
There are lot’s of mistake in your code, i am writing whole code , with comments. You can refer that.
Take reference from this code
can u please explain from line 18 to 25 logic.
int t=abs(N-M);
int max=(N>M)?N:M;
int temp[max];
for(int i=0; i<max; i++)
{
if(i<t)
temp[i]=0;
else if(N<M)
temp[i]=a[i-t];
else if(N>=M)
temp[i]=b[i-t];
}
it means t has |N-M| i.e, mode of (N-M) positive difference
It means that if N is greater then max has value of N , else if M is greater then max has value of M
let N = 5 & M =3, t = 5-3(2)
so if i<2 temp[0, 2] = 0;
if N<M , it is not true for this case
If N>=M, temp[3, 5] = b[0, 2]
So it means that temp[0, 2] = 0 and temp[3, 5] = b[0, 2]
so this step was implemented soo that in blank spaces no garbage value is added to it except 0.?
Yes , this statement ensures it that there should be no garbage value.