Explore 100's Of Free Video Tutorials

Keep Learning, Keep Coding & Keep Sharing

Print patterns of numbers and stars

Notes:

Print patterns of numbers and stars:
Displaying stars in rows and columns using Javascript loops:

var rows=5;
var cols=5;
for(var i=1;i<=rows;i++)
{
for(var j=1;j<=cols;j++)
{
document.write(" * ");
}
document.write("<br/>");
}

Output:
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *

Interview Questions: