I dont get code for this problem after many efforts

i dont get code for this problem after many efforts plz solve it

Hello @rakesh800650,

Try to implement the following:

an outer loop for each row.
a) for upper n/2 rows:
…i) logic for left side space
…ii) logic for printing left side digits
…iii) logic for inner space
…iv) logic fro right digits
b) for remaining lower rows:
…i) logic for left side space
…ii) logic for printing left side digits
…iii) logic for inner space
…iv) logic fro right digits
c) change row

DESCRIPTION:
if outer loop iterates for i=0 to n

  1. for upper n/2+1 rows i.e till middle row,
    loop for inner space will iterate for j=0 to j<(2*i-1)
    when i=0, no space
    i=1, 1 space
    i=2, 3 spaces
    i=3, 5 spaces

  2. for lower half rows,
    first decrement s by 2, then
    loop inner space for j=0 to j<s
    i=4, 3 spaces
    i=5, 1 space
    i=6, 0 spaces

Always look for the flow to print pattern

Hope, this would help.
if you still have doubts, let me know.
But try this yourself first.

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.