<!--Javascript program to print the following pattern (for n input lines).-->
<!--when n=4-->>
01
01 02
01 02 03
01 02 03 04
<html>
<head>
<title>Javascript</title>
<script type="text/javascript">
var a;
var n=prompt("Enter a number for the no. of rows in a pattern");
for(var i=1;i<=n;i++)
{
for(var j=1;j<=i;j++)
{
document.write("0"+j+" ");
}
document.write("<br />");
}
</script>
</head>
<body>
</body>
</html>
<!--when n=4-->>
01
01 02
01 02 03
01 02 03 04
<html>
<head>
<title>Javascript</title>
<script type="text/javascript">
var a;
var n=prompt("Enter a number for the no. of rows in a pattern");
for(var i=1;i<=n;i++)
{
for(var j=1;j<=i;j++)
{
document.write("0"+j+" ");
}
document.write("<br />");
}
</script>
</head>
<body>
</body>
</html>
No comments:
Post a Comment