Skip to content

Commit

Permalink
P87~P91
Browse files Browse the repository at this point in the history
  • Loading branch information
tamadon committed Mar 17, 2013
1 parent d398a52 commit 6ee6a3f
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
14 changes: 14 additions & 0 deletions for.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 1から5までの合計を求める
sum = 0
for i in 1..5
sum = sum + i
end
print sum, "\n"
# fromからtoまでの合計を求める
from = 10
to = 10
sum = 0
for i in from..to
sum = sum + i
end
print sum, "\n"
9 changes: 9 additions & 0 deletions times.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# encoding: UTF-8

4.times do
print "いちめんのはな\n"
end

5.times {
print "いちめんの花\n"
}
5 changes: 5 additions & 0 deletions times2.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#encoding: UTF-8

5.times do |i|
print i,"回目の繰り返しです。\n"
end
5 changes: 5 additions & 0 deletions times3.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#encoding: UTF-8

5.times do |i|
print i+1, "回目の繰り返しです。\n"
end

0 comments on commit 6ee6a3f

Please sign in to comment.