Wednesday 26 July 2017

pyramid2_html

<html>
<head>
<title>pyramid2</title>
<basefont size=50>
</head>
<body>
<script>
var a,b,c,d,e=5;
for(a=1;a<6;a++)
{
document.write("<br>");
for(b=0;b<a;b++)
{
document.write("&nbsp;&nbsp;&nbsp;");
}
for(c=a;c<6;c++)
{
if(c%2!=0)
{
document.write("1 ");
}
else
{
document.write("0 ");
}
}
for(d=1;d<e;d++)
{
if(d%2==0)
{
document.write("1 ");
}
else
{
document.write("0 ");
}
}
e--;
}

</script>
</body>
</html>

OUTPUT


No comments:

Post a Comment