Newer
Older
Ruby / kaimono.rb
@NAMBA Kodai NAMBA Kodai on 29 Sep 2021 425 bytes 2021-09-29 20:22:44
#!/usr/bin/env ruby
# _*_ 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)
puts"お買い上げありがとうございました!"