Paiza の算術・代入演算メニューの演習問題のRubyでの模範解答です。
簡単なので、いらないような気もしますが、ご参考までに。
STEP: 1 足し算
https://paiza.jp/works/mondai/arithmetic_substitution_op/arithmetic_substitution_op__arithmetic_step1
n = 1231 + 5178
puts n
STEP: 2 引き算・掛け算
https://paiza.jp/works/mondai/arithmetic_substitution_op/arithmetic_substitution_op__arithmetic_step2
a,b = gets.split(' ').map(&:to_i)
d = a - b
p = a * b
puts "#{d} #{p}"
STEP: 3 割り算
https://paiza.jp/works/mondai/arithmetic_substitution_op/arithmetic_substitution_op__arithmetic_step3
a = 437326
b = 9085
x = a / b
y = a % b
puts "#{x} #{y}"
STEP: 4 掛け算 2
https://paiza.jp/works/mondai/arithmetic_substitution_op/arithmetic_substitution_op__arithmetic_step4
a,b,c = gets.split(' ').map(&:to_i)
x = a * a
y = b * b + c * c
puts "#{x} #{y}"
a = 202
b = 134
c = 107
n = ((a + b) * c) ** 2
puts n
STEP: 6 累乗 2
https://paiza.jp/works/mondai/arithmetic_substitution_op/arithmetic_substitution_op__arithmetic_step6
a,b,c,d = gets.split(' ').map(&:to_i)
n = ((a + b) * c) ** 2 % d
puts n
STEP: 7 代入演算 1
https://paiza.jp/works/mondai/arithmetic_substitution_op/arithmetic_substitution_op__substitution_step1
n = 0
n = n + 3286
n = n * 4736
n = n % 12312
puts n
STEP: 8 代入演算 2
https://paiza.jp/works/mondai/arithmetic_substitution_op/arithmetic_substitution_op__substitution_step2
n = 0
a,b,c = gets.split(' ').map(&:to_i)
n = n + a
n = n * b
n = n % c
puts n
STEP: 9 代入演算 3
https://paiza.jp/works/mondai/arithmetic_substitution_op/arithmetic_substitution_op__substitution_step3
n = 10000
n = n / 361
n = n % 28
puts n
STEP:10 代入演算 4
https://paiza.jp/works/mondai/arithmetic_substitution_op/arithmetic_substitution_op__substitution_step4
a,b = gets.split(' ').map(&:to_i)
n = 10000
n = n / a
n = n % b
puts n