<h1 align="center">Guess The Number</h1>
<script language="VBScript">
randomize
d=Int((100 * Rnd) + 1)
c=d
for i=1 to 50
x=inputbox("Enter a number")
if cInt(x)=c then
document.write("Congrats you have guessed the right number and you made"&i&" guesses.")
exit for
elseif cInt(x)>c then
msgbox("Your number is greater")
elseif cInt(x)<c then
msgbox("Your number is lower")
end if
next
</script>
Instructions :-
<script language="VBScript">
randomize
d=Int((100 * Rnd) + 1)
c=d
for i=1 to 50
x=inputbox("Enter a number")
if cInt(x)=c then
document.write("Congrats you have guessed the right number and you made"&i&" guesses.")
exit for
elseif cInt(x)>c then
msgbox("Your number is greater")
elseif cInt(x)<c then
msgbox("Your number is lower")
end if
next
</script>
Instructions :-
- Copy this code and paste it in notepad
- Save it with an extension .html
- 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