Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/rderoldan1/learn-ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
rderoldan1 committed Mar 28, 2012
2 parents 837f741 + 3223a80 commit eb1f357
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Empty file modified Semana 4/Problema 1/README.md
100644 → 100755
Empty file.
32 changes: 32 additions & 0 deletions Semana 4/Problema 1/aleatorio.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
def cara(numero)
total =0
total1=0
while numero>0 do
ok = rand(2)

if ok==0
puts "cara"
total +=1
else ok==1
puts "sello"
total1 +=1
end
numero -=1

end
puts "TOTAL caras #{total}, contra #{total1} sellos"

end


class Juego
puts "entre juegos"
juegos = gets.chomp.to_i

if juegos ==0
puts "introduzca un numero valido "
else
cara(juegos)
end

end

0 comments on commit eb1f357

Please sign in to comment.