not able to code question 20 please help
Doubt regarding 20 th question in pattern practice questions
What problem are you facing exactly? I’ll give you some hints to get started, you should try coding using them and if you still face a problem then let me know, I’ll give more hints.
So, first thing to see is that you have to print 1 star in the first and nth rows, and 2 stars in all the other rows. Apart from that you need to keep track of the spaces to be printed. So, in a way you would require 4 loops inside your while loop. First one for spaces, then for star, then spaces again and then star again. All you need to do now, is try to find a relation between the numbers of spaces being printed for each row (in terms of n) and how they are increasing or decreasing as n increases, i.e as you go to the next row.
I hope this helps, please try coding it now.