# A program that outputs the total amount of merchandise including shipping and shipping (tax included) when the number of merchandise is entered.

Asked 2 months ago, Updated 2 months ago, 4 views

Under the conditions of 3,000 yen for a T-shirt, 1,500 yen for a face towel, and 1,000 yen for a muffler towel.
The shipping cost is as follows.
·If the total amount (excluding tax) is over 10,000 yen, the shipping fee is free.
·If the total price (tax included) is less than 10,000 yen, the shipping fee is 880 yen
The consumption tax will be 10%.

Also, what should I fix to make the example run as follows?
Number of T-shirts: 1
Number of face towels: 1
Number of muffler towels: 1
The total price of the item (excluding tax) is 5,500 yen
Shipping (tax included) is 880 yen
Total price including shipping (tax included) is 6930 yen

``````int main (void)
{
int, f, m;
printf("Number of T-shirts:");
scanf("%d", & t);
printf("Number of face towels:");
scanf("%d", & f);
printf("Number of muffler towels:");
scanf("%d", & m);
if (3000*t+1500*f+1000*m<10000) {
printf("The total price of the product is %d yen.\n"3000*t+1500*f+1000*m);
printf("Shipping fee is 880 yen.\n");
printf ""Total amount including shipping (tax included) is %d yen.\n"3300*t+1650*f+1100*m+880);
}   else{
printf("The total price of the product is %d yen.\n", 3000*t+1500*f+1000*m);
printf("Free shipping.\n");
printf ""Total amount including shipping (tax included) is %d yen.\n"3300*t+1650*f+1100*m);
}
return 0;
}
``````

By the way, the error is as follows.

``````\$ccex0204.c
ex0204.c:In function 'main':
ex0204.c:13:48:error:expected') 'before numeric constant
printf("The total price of the product is %d yen.\n"1000*t+1500*f+3000*m);
^~~~
ex0204.c:13:37:warning:format'%d'expects a matching'int'argument [-Wformat=]
printf("The total price of the product is %d yen.\n"1000*t+1500*f+3000*m);
~^
ex0204.c:15:59:error:expected') 'before numeric constant
printf ""Total amount including shipping (tax included) is %d yen.\n"1100*t+1650*f+3300*m+880);
^~~~
ex0204.c:15:48:warning:format'%d'expects a matching'int'argument [-Wformat=]
printf ""Total amount including shipping (tax included) is %d yen.\n"1100*t+1650*f+3300*m+880);
~^
ex0204.c:19:59:error:expected') 'before numeric constant
printf ""Total amount including shipping (tax included) is %d yen.\n"1100*t+1650*f+3300*m);
^~~~
ex0204.c:19:48:warning:format'%d'expects a matching'int'argument [-Wformat=]
printf ""Total amount including shipping (tax included) is %d yen.\n"1100*t+1650*f+3300*m);
~^
``````

c

2022-09-30 12:09

Arguments for function calls are comma-separated.

A comma-separated list of expressions of any complete object type (cannot be a comma operator).

2022-09-30 12:09

``````printf("The total price of the product is %d yen.\n"3000*t+1500*f+1000*m);
``````

is

``````printf("The total price of the product is %d yen.\n", 3000*t+1500*f+1000*m);
``````

Separate with a comma.

2022-09-30 12:09

## If you have any answers or tips

Popular Tags
python x 4439
android x 1590
java x 1475
javascript x 1386
c x 903
c++ x 832
ruby-on-rails x 681
php x 678
python3 x 651
html x 631