Jump to content

Guess the number/With feedback: Difference between revisions

Line 1,029:
You got the number correct on the eighth guess!
</pre>
 
=={{header|Tiny Craft Basic}}==
<syntaxhighlight lang="basic">10 cls
 
20 let r = int: (rnd) * 100 + 1
 
30 print "hilo game"
40 print "guess the nusmber between 1 and 100"
 
50 rem loop
 
60 let t = t + 1
 
70 input "guess: ", g
 
80 if g <> r then 110
 
90 print "you guessed it in ", t ," tries."
100 goto 220
 
110 rem endif
 
120 if g > r or g < 1 then 140
 
130 print "too low"
 
140 rem endif
 
150 if g < r or g > 100 then 170
 
160 print "too high"
 
170 rem endif
 
180 if g >= 1 and g <= 100 then 200
 
190 print "invalid guess"
 
200 rem endif
 
210 if g <> r then 50
 
220 shell "pause"</syntaxhighlight>
 
=={{header|Crystal}}==
305

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.