Skip to content

Instantly share code, notes, and snippets.

@ravidaram
Last active December 23, 2015 18:49
Show Gist options
  • Save ravidaram/6678732 to your computer and use it in GitHub Desktop.
Save ravidaram/6678732 to your computer and use it in GitHub Desktop.
codeeval
puts "enter number"
n=gets.chomp.to_i
p=0
pp=0
2.upto(n) do |i|
2.upto(i-1) do |j|
p=i%j
break if(p==0)
end
if(p==1)
n2=i.to_s
if(n2==n2.reverse)
pp=n2
end
end
end
puts pp
puts "enter a string"
str=gets.chomp
str=str.downcase
puts str
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment