Return to Snippet

Revision: 48685
at July 7, 2011 20:17 by elias


Initial Code
intentos = 0

puts"adivinalo"

secreto = rand(20)
while (intentos < 5) do
numero_jugador = Integer(gets.chomp) # teclado
intentos = intentos + 1 # intentos += 1

if numero_jugador < secreto
puts "tu numero es menor que el secreto"
elsif numero_jugador > secreto
puts "tu numero es mayor que el secreto"
else numero_jugador == secreto
break
end

end

if numero_jugador == secreto
puts "adivinaste mi numero en #{intentos} intentos"
end

if numero_jugador != secreto
puts "has perdido! mi numero secreto era #{secreto}"
end

Initial URL


Initial Description


Initial Title
Adivinar numero

Initial Tags


Initial Language
Ruby