Created
February 20, 2016 03:42
-
-
Save irinoyasu/15df7fe643e78d6898a7 to your computer and use it in GitHub Desktop.
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
# # 3の倍数の時だけをやってみる | |
# array = Array 1..100 | |
# array.each do |i| | |
# if i%3 == 0 | |
# puts "SAN" | |
# else | |
# puts i | |
# end | |
# end | |
# # 3のつく数字の時だけをやってみる | |
# array = Array 1..100 | |
# array.each do |i| | |
# if i.to_s.include?("3") | |
# puts "SAN" | |
# else | |
# puts i | |
# end | |
# end | |
# 3の倍数の時 or 3のつく数字の時を合わせる | |
array = Array 1..100 | |
array.each do |i| | |
if i%3 == 0 || i.to_s.include?("3") | |
puts "SAN" | |
else | |
puts i | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment