Newer
Older
Ruby / reji.rb
@OBA Miyabi OBA Miyabi on 12 Oct 2021 445 bytes 2021-10-12 19:30:33
# coding: utf-8
puts"スーパーのレジだよっ。"
puts"買った物の値段を入れてね。(100円は100と入力しよう)"
gokei=0

while true
  puts"値段は?(終わりたい時はqを押してね)"
  nedan=gets.chomp

  if nedan=="q"
    break
  end
    
  gokei+=nedan.to_i
  printf("今の合計は%d円だよ。\n",gokei)
end

printf("合計%d円です。\n",gokei)
puts"お買い上げありがとうございました!"