#Java 7, 230230 215 bytes
int c=0;void m(int[]a){int l=a.length;iflength,j=-1,i=-1;if(l<1)return;int x[]=newreturn;int[]x=new int[l-1];for1];while(int j=0;j<c;j++++j<c)System.out.printp(" ");for(int i=0;i<l;i++){System.out.print;++i<l;p(a[i]+" ");if)if(i<l&i>0)x[i-1]=(a[i-1]+a[i])%10;%10;p("\n");c++;m(x);}void p(String s){System.out.println();c++;mprint(xs);}
This ended up being a bit longer than I thought.. Maybe it can be golfed a bit more though, since I kinda messed up I think..
Some bytes saved thanks to @GiacomoGarabello.
Try it here.Try it here.
class Main{
static int c = 0;
static void m(int[] a){
int l = a.length;length,
if (lj <= -1) {,
i = -1;
return;
if(l < 1){
} return;
}
intint[] x[]x = new int[l-1];
for while(int j = 0; j++j < c; j++c){
System.out.printp(" ");
}
for (int i = 0;; i++i < l; i++){
System.out.printp(a[i] + " ");){
if (i < l & i > 0){
x[i - 1] = (a[i - 1] + a[i]) % 10;
}
}
}p("\n");
c++;
System.out.printlnm(x);
}
c++;
static void p(String s){
mSystem.out.print(xs);
}
static void printAndReset(int[]aint[] a){
m(a);
c = 0;
System.out.println();
}
public static void main(final String[] a){
printAndReset(new int[]{ 7, 5, 0, 9 });
printAndReset(new int[]{ 0 });
printAndReset(new int[]{ 1, 2 });
printAndReset(new int[]{ 8, 7 });
printAndReset(new int[]{ 0, 0 });
printAndReset(new int[]{ 1, 4, 2 });
printAndReset(new int[]{ 0, 1, 0 });
printAndReset(new int[]{ 1, 0, 0, 0 });
printAndReset(new int[]{ 1, 2, 3, 4 });
printAndReset(new int[]{ 1, 2, 3, 5, 8 });
printAndReset(new int[]{ 9, 2, 4, 5, 3, 2, 2 });
}
}