Page

Program to print the series in java script

<html>
<head><h2><center>program to print the series</h2></center></head>
<body>
<script type="text/javascript">
n=parseInt(prompt("enter the number of rows"," "));
for(i=1;i<=n;i++)
{
document.write("<br>");
for(j=1;j<=n-i;j++)
document.write("&nbsp&nbsp");
for(k=1;k<=i;k++)
document.write(k);
for(l=i-1;l>0;l--)
document.write(l);
}
</script>
</body>
</html>

No comments:

Post a Comment