Pattern Triangle

check the code cannot solve the pattern.

It’s been a month still I can’t make logic for simple code give some advice on how to improve the logic building.

code:- https://ide.codingblocks.com/s/452918

question:-https://online.codingblocks.com/app/player/189104/content/180066/4778/code-challenge

hello @dasvishal60

logic will improve only by practice, so practice a lot.
ss

are u trying to solve this problem or some other problem?

becuase ur code is printing * as well , but in pattern there is no such thing

yes! this problem i was trying to solve i use * to count the space only later i was going to replace with " " or “\t”

ok,in each row we have some spaces in starting and then numbers thats it. no need to handle spaces that are in right of the pattern.

ok but numbers is also not printing correctly

check this->

how to solve this
a) printing spaces
if row number is i , then n-i spaces are there in the left
so to print spaces simply run a loop n-i times and print that many spaces

b) printing numbers

divide the triangle into two halves.
now note.
the first number of each row is i . and then it is increasing from i , for i number of times.

for example if row numbr is 3 then row will start from 3 and it will increase 3 times.
3 4 5
and now print the decresing series in the same way

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.