Pattern of number and star


to proceed further what is the way to print star pattern one pattern which is inside one one is the right one

hi @dipeshgupta197 your appoarch to print the pattern of number was good you just need to add a loop to print the star pattern
Key Observation: Upon a close inspection to the pattern of number and star a pattern could be found which would help us to determine the number of times the loop must run inorder to print the star pattern as you can quite easy see that number of stars in the given row are (2*i - 1) here i denotes the ith row (assuming i=0 for row 1). Now you just need to implement a loop after the loop that is being used to print the pattern of number in order to print pattern of star

Code for the same could be found here:

Hope this might helps :grinning:

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.