Wrong pattern is showing

When I am entering some large values for n such as 10, 13, 15 and so on ; A different pattern is showing for these values. Please explain why.


Here is the output when I enter n = 13.

@saijaltripathy_e79096f8f1ec20e3 at look carefully you’re getting the correct pattern but however it is not symmetric because when you give higher values of n then the ‘val’ in your program can be of TWO DIGITS that means it’ll take 2 spaces to display itself whereas you SINGLE DIGIT ‘val’ would have taken single place for display. So your pattern is right but it is not possible for you to make this pattern. symmetric for larger values of n.

Ok, so my code is correct?

@saijaltripathy_e79096f8f1ec20e3 Yes your code is correct however you can add spaces to make it look more clean.

Ok, got it! Thank you very much!

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.

1 Like