please share me the logic for this code and explain me please
Pattern double sided arrow
please reply me fast
please explain me the logic
please explain me the full code logic
try to understand once, it’s simple. i am explaining it for input 7,
run a for loop for 7 times, and print space then 1, so that you get
1
then you have to run a for loop for n/2 +1 time that is 4, and each time you have to decrease the number of space by 1, then print number in reverse order like
2 1
after printing that print number in ascending order
2 1 1 2
do this n/2 times , then your upper part will be like this
1
2 1 1 2
3 2 1 1 2 3
4 3 2 1 1 2 3 4
do the same thing in reverse order for next half
at last if(n!=1) without it also we can just cout<<1 Is it possible just check it once
is it necessary then please explain me why
Last line ka 1 bhi toh print krwana hai na? Agar n 1 ke equal hai toh last line wala 1 already print ho jayega, pr agar ni toh hum explicitly print kr rhe hai. Just a check.
without that also we can print it just check it once exclude it and run it once
check for input n = 1, you will get it.
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.