問題一覧
お問い合わせ
light_mode
dark_mode
残り時間:
00:00
速度:
0
文字/分
消費税計算 (C++)
問題
消費税(10%)を計算して、合計金額を表示するプログラムです。
入力例
1000
出力例
商品価格: 1000円 消費税: 100円 合計金額: 1100円
スタート
参照コード
コピーはできません。自分でタイピングしてください。
#include <iostream> using namespace std; int main() { int price; float taxRate = 0.10; // 消費税率10% cin >> price; int taxAmount = price * taxRate; int totalPrice = price + taxAmount; cout << "商品価格: " << price << "円" << endl; cout << "消費税: " << taxAmount << "円" << endl; cout << "合計金額: " << totalPrice << "円" << endl; return 0; }
入力エリア
コンパイル&実行
3