LoginSignup
0
0

More than 1 year has passed since last update.

ループ処理

Posted at

次の要件を満たすプログラムを実装

・1~10の数値を順番に足し合わせる
・足し算の合計値がターミナルに出力される
・ループ処理を用いて実装

sum = 0

10.times do |i|
sum += i + 1
end

puts sum
#1から10まで順番に足していくルプ処理を使った

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0