Last active
December 23, 2015 18:49
-
-
Save ravidaram/6678732 to your computer and use it in GitHub Desktop.
codeeval
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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