I want to generate the following pattern using for() loop only.... how can i do this i've tried but unfortunately failed to solve ....
when user inputs 3
1 1 1 1 1
1 2 2 2 1
1 2 3 2 1
1 2 2 2 1
1 1 1 1 1
when user inputs 4;
1 1 1 1 1 1 1
1 2 2 2 2 2 1
1 2 3 3 3 2 1
1 2 3 4 3 2 1
1 2 3 3 3 2 1
1 1 1 1 1 1 1
I just want to know the algorithm or just a hint?