1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

paizaラーニング解答: 算術・代入演算メニュー[Ruby]

Posted at

算術・代入演算メニュー

STEP: 1 足し算

puts 1_231 + 5_178

STEP: 2 引き算・掛け算

a, b = gets.split.map(&:to_i)
puts "#{a - b} #{a * b}"

STEP: 3 割り算

a = 437_326
b = 9_085 
puts "#{a / b} #{a % b}"

STEP: 4 掛け算 2

a, b, c = gets.split.map(&:to_i)
puts "#{a * a} #{b * b + c * c}"

STEP: 5 累乗

a, b, c = 202, 134, 107
puts ((a + b) * c) ** 2

FINAL問題 累乗 2

a, b, c, d = gets.split.map(&:to_i)
puts (((a + b) * c) ** 2) % d

STEP: 1 代入演算 1

n = 0
n += 3_286
n *= 4_736
n %= 12_312
puts n

STEP: 2 代入演算 2

a, b, c = gets.split.map(&:to_i)
n = 0
n += a
n *= b
n %= c
puts n

STEP: 3 代入演算 3

n = 10_000
n /= 361
n %= 28
puts n

FINAL問題 代入演算 4

a, b = gets.split.map(&:to_i)
n = 10_000
n /= a
n %= b
puts n
1
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?