Sunday 14 June 2015

Shapes and patterns using VB Script

<script language="vbscript">
for a=1 to 5
for b=1 to 5
if  a=1 OR b=1 OR b=5 OR a=3 then
document.write("#")
else
document.write(" . ")
end if
next
document.write("<br>")
next

document.write("<hr>")

for i=1 to 5
for j=1 to 5
if i=1 OR j=1 OR i=5 then
document.write("#")
else
document.write(" . ")
end if
next
document.write("<br>")
next

document.write("<hr>")

for p=1 to 5
for q=1 to 5
if p=1 OR p=5 OR p+q=6 then
document.write("#")
else
document.write(" . ")
end if
next
document.write("<br>")
next

document.write("<hr>")

for a=1 to 5
for b=1 to 5
if  a+b=6 OR a=b then
document.write("#")
else
document.write(" . ")
end if
next
document.write("<br>")
next

document.write("<hr>")

for a=1 to 5
for b=1 to 5
if  a=1 OR b=3 then
document.write("#")
else
document.write(" . ")
end if
next
document.write("<br>")
next

document.write("<hr>")


</script>

Instructions :-
  1. Copy this code and paste it in notepad
  2. Save it with an extension .html
  3. Run it on Internet Explorer only.It might not work on other browser as they do not support vb language.

No comments:

Post a Comment