This is the example of the required output :
1 2 3 4 5 6 7 8 9 0
2 3 4 5 6 7 8 9 0 1
3 4 5 6 7 8 9 0 1 2
4 5 6 7 8 9 0 1 2 3
5 6 7 8 9 0 1 2 3 4
6 7 8 9 0 1 2 3 4 5
7 8 9 0 1 2 3 4 5 6
8 9 0 1 2 3 4 5 6 7
9 0 1 2 3 4 5 6 7 8
0 1 2 3 4 5 6 7 8 9
This is what I have written so far :
for (var nam = 9; nam > 0; nam--){
for (var x = 1 ; x <= 9; x++){
if (x == nam){
process.stdout.write(x +" 0 ");
} else {
process.stdout.write(x + " ");
}
}
console.log();
}