i am not able to find the error in my code please help me in this.
NOT ABLE TO PRINT THE PATTERN CORRECTLY.
In challenge hollow diamond pattern not able to find out the error in my code
i have uploaded it as hollow_dia. please tell me where to share it
and i have already share u a screen shot of my code
its not possible to debug screenshots , please paste your code on ide.codingblocks.com and go to file->save ,your url will get updated in the bar ,share it here
your approach isnt correct
start with nst = (n/2 + 1), cst = 1, rows = 1, nsp = -1,total rows = n;
- The given pattern is seen as first stars then spaces and then stars .So for each row do the work of stars first , then that of spaces and then that of stars. And then change the variables accordingly for next iterations.
- But this work will not help u to pass the test cases as there will be 1 extra star in the first line and last line. For e.g.,
* * * * * * //Extra star
* * * *
* *
* * * *
* * * * * * // Extra Star
- To handle this condition all you need to do is run your second look 1 time less only when control is in first and last line.
if(rows == 1 || rows == n) cst = 2;
see this: