結果

問題 No.56 消費税
ユーザー Maeda
提出日時 2025-03-03 11:40:45
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 438 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 25,728 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2025-03-03 11:41:14
合計ジャッジ時間 1,078 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 4
other WA * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:30: warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘double *’ [-Wformat=]
    5 |         int inputA = scanf("%d",&a);
      |                             ~^  ~~
      |                              |  |
      |                              |  double *
      |                              int *
      |                             %le
main.c:9:30: warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘double *’ [-Wformat=]
    9 |         int inputB = scanf("%d\n",&b);
      |                             ~^    ~~
      |                              |    |
      |                              |    double *
      |                              int *
      |                             %le

ソースコード

diff #

#include <stdio.h>

void main(void){
	double a = 0 , b = 0;
	int inputA = scanf("%d",&a);
	if(inputA == 2){
		printf("Aの入力エラー\n");
	}
	int inputB = scanf("%d\n",&b);
	if(inputB == 2){
		printf("Bの入力エラー\n");
	}
	printf("入力A:%f\n",a);
	printf("入力B:%f\n",b);
	double tax = 100/b;
	double sum = a + tax;
	printf("消費税分:%fユキコダ\n",tax);
	printf("税込み金額:%1.fユキコダ\n",sum);
}
0