Skip to content
Advertisement

Stuck with the number pattern printing in PHP

Stuck with the number pattern printing logic. Let me know what i am doing wrong as my file is simply going on execution without giving me a pattern.

My Code —

JavaScript

Pattern to achieve —

JavaScript

UPDATE

After applying new changes following are the screenshots —

On STAR USEAGE

ON BLANK USAGE

Advertisement

Answer

Your error is in the last for, that should not exist since you are already looping.

And create a new variable which will hold the printed text for the next increment.

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement