20. JavaScript Program to Display 1 to 99 numbers in 5 Rows Sequentially.
How does this program work?
- In this program we are going to learn about how to display 1to 99 numbers in 5 rows sequentially using JavaScript.
- In this program we are using for loop to display numbers.
- And 'if' condition is used to print 5 numbers on each line sequentially.
Here is the code
<html>
<head>
<title>JavaScript program to display 1 to 99 numbers in 5 rows sequentially</title>
</head>
<body>
<div id="num"></div> </body>
<script type="text/javascript">
var i;
//To print 1 to 99 numbers sequentially
for(i = 1; i <= 99; i++)
{
//To print 5 numbers on each line
if(i%6 == 0)
{
document.write( "</br>" );
}
document.writeln(i);
}
</script>
</html>