Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! usr/bin/ruby
- # numeros primos
- puts 'Inserta el numero que quieras comprobar si es primo'
- STDOUT.flush
- n = gets.chomp
- num = n.to_i
- i = 2
- while i < num do
- if num % i == 0
- print 'no es primo \n'
- break
- else
- puts num, " es primo\n"
- break
- end
- i += 1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement