0
why y is always 0 no matter what input I enter? please help
# outputs the number with the most even divisors x=gets.to_i y=gets.to_i k1=0 k2=0 for i in 1..x if x%i==0 if i%2==0 k1+=1 end end end for i in 1..y if y%i==0 if i%2==0 k2+=1 end end end if k1==k2 puts "#{x} #{y}" elsif k1>k2 puts x elsif k2>k1 puts y end
2 Respuestas
+ 5
Well didn't quiet understand what are you referring to but
I tried with input as
18
12
18(2,6). 12(2,4,6).
and it outputs 12 so I guess y is not 0.
If you are using solo learn compiler then enter first number then go to next line that is press enter then input second number and then submit.
0
thanks, didn't know it has to be on the second line