Permalink
Browse files

Merge branch 'master' of https://github.com/rderoldan1/learn-ruby

  • Loading branch information...
2 parents 837f741 + 3223a80 commit eb1f3574daa9cda798457a836a7f5018bc4da28b @rderoldan1 committed Mar 28, 2012
Showing with 32 additions and 0 deletions.
  1. 0 Semana 4/Problema 1/README.md
  2. +32 −0 Semana 4/Problema 1/aleatorio.rb
View
0 Semana 4/Problema 1/README.md 100644 → 100755
No changes.
@@ -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.