what exactly has to be printed?
Pattern mountain
@jaankita2000
Consider for n=4
1________1
1 2_____2 1
1 2 3__3 2 1
1 2 3 4 3 2 1
For the first row, there are 2*n-3 spaces and for subsequent rows, it decrements by 2.
First work to print the numbers in increasing order then print the spaces accordingly and then the same pattern of numbers but in reverse order.
So first do work for numbers then for spaces and then for numbers again.
And then update variables accordingly for next iterations.
Each number is separated from other by a tab so use ’ \t’ for tab space.
Similarly for n=6
Output would be like this:
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.