Ploblem in "PASCAL TRAINGLE'S" logic

I am unable to write the code for finding the sum of the adjacent elements of the preceding row and adding it to the element in the next row.
Please assist me in building the right logic for the entire program.
Thanks.

Hello @shrey_sharma,

Algorithm:

  1. Do the following for i=1 to n:
  2. Print the preceding space
    2.1. loop from 1 to (n-i+1)
  3. Print the elements of pascal triangle:
    3.1. Declare a variable num=1;
    3.2. loop from j=1 to i
    …if j=1: print j
    …else: compute num=num*(i-j+1)/(j-1) and print num

Hope, this would help.
Give a like if you are satisfied.

please tell me where to include the spaces in the code to get the same sample output

Hello @shrey_sharma,

You can use the following
For space:(two)
cout<<" “;
For element:(three)
cout<<element<<” ";

Hope, this would help.
Give a like if you are satisfied.

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.