Triangle pattern


i am facing an error in a test case what could be the mistake

Hello @utkarsh2504,

Your code is specific to 4.
Try to print 5 and you would understand your mistake.
Make it a generalized code that would work for different values of n.

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

i made a change still one of the test case is failing when i enter 6 and i cannot find the error

@utkarsh2504 please, check it again carefully.
It is giving wrong answer of 6.
Also, The constraint given in the question says 0<n<10.

You can compare the output of your code with mine:

Or if you want i can correct your code.
But, i would highly suggest to try to resolve it yourself first.
As you are in a learning phase.

Hope, this would help.

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.