Ex 2

Run Settings
LanguagePerl
Language Version
Run Command
class Eliminarrepetidos def solucion(); $arreglo=[] print "Ingrese el tamaño del array: " $4n = (gets.chomp).to_i; for (x in 1..n){ print "Ingresa un valor: " valor= gets.to_i; $arreglo << valor; } puts "Lista actual: #{arreglo}"; $arreglo.sort! $result = arreglo.reject.with_index do |ele,index|{ $res = ($arreglo[index+1] ^ ele); $res == 0 ; } print "Lista nueva: #{result}" } } obj = Eliminarrepetidos.new obj.solucion()
Editor Settings
Theme
Key bindings
Full width
Lines