print "Enter no1: " no1 = gets.chomp.to_i print "Enter no2: " no2 = gets.chomp.to_i for i in 1..no1 do for j in 1..no2 do puts i, j end end