0 喜歡 0 不喜歡
9.2k 瀏覽

Question 10: Please write a program that can calculate tax 7% (0.07) of a product price, then outputs the tax and a total price including the tax.

Hint:

*Use %.2f for two decimal points*

*Printf a new line between the tax and a total price including tax*

Input1

80

Output1

5.60
85.60

 

Input 2

452

Output2

31.64
483.64

 

[考試] 最新提問 分類:Final examination | 用戶: (5.9k 分)
ID: 41975 - 從幾時開始: 無限制 - 到幾時結束: 2018-01-17 16:30

修改於 用戶: | 9.2k 瀏覽

22 個回答

0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>
#include <stdlib.h>
int main(){
*** * *** * ** **** * n;
* * * * * ***** *** * m=0.07;
    
* **** * * ** * * *** ** * ****** ** ** ***
*** ** * ***** * * * ** * *** * n*m);
    
* * * * *** * ** * * * **** * * **** *** ***
*** ** ** * ** * * * ** * *** * ****** * **** *** * ** ** **** ** *** ** *** *** **** ***** ** * ** *
* * ** * *** *** * * ***** * * ** *** ** *** ** ****** *** * * * * ***** 0;
** * ***** **** ** * * *** * * **** * ** * * ****** ** ** * * * * * * *
100/100 最新回答 用戶: (254 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>
#include <stdlib.h>

int main(){
** * ** * * ** ** * **** a;
* * *** ** ** ** ** * * b=0.07;
* ** *** * ** *** * *
**** ***** *** *** ** * * **** **** &a);
* * ** ** ** ** ** ** * ***** * * * * **** a*b);
*** * *** ***** *
* * ***** * * * ** ** ** ***** ** **** (a*b)+a);
** ** * * * * * *
* *** * *** * ** ***** * ** ***** * * *
**** * * *** ** ** * * *** 0;
}
** * * ***** * *** * * * *
最新回答 用戶: (183 分)
0 0
prog.c: In function 'main':
prog.c:9:14: warning: unknown conversion type character '>' in format [-Wformat=]
     printf("%>2f", a*b);
              ^
prog.c:9:12: warning: too many arguments for format [-Wformat-extra-args]
     printf("%>2f", a*b);
            ^~~~~~
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>
#include <stdlib.h>

int main(){ ** * * * ** * * * ** *** **
* ** *** * ***** * a;
** ** * * ** * ** * ** b=0.07;
*** * * ** * ** ** ** *
** *** * * ** ***** * * *** * * *** *** ****
* *** * * * *** *
* * **** ** * ** * * * ** * *** *** * a*b);
* ** ** **** **** *** *** * * * * * * * (a*b)+a);
** * * * * **** * *

* **** * **** ** 0;
}
100/100 最新回答 用戶: (283 分)
0 0
prog.c: In function 'main':
prog.c:11:18: warning: format '%d' expects a matching 'int' argument [-Wformat=]
     printf("%.2f%d", a*b+a);
                  ^
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include *** * *** * *
int main()
{
** * ********* ** * n;
* ** * * * * *** * * sum,c;
** ** **** * *** * ** * ** ******* ** * ** * * ***
** ***** ** * ** * * = n*(0.07);
** *** **** ** **** * = n + c;
* ** * * ** * ****** ** * ** ** * **** * ** *
  
0/100 最新回答 用戶: (192 分)
0 0
prog.c: In function 'main':
prog.c:7:17: error: 'n' undeclared (first use in this function)
     scanf("%d",&n);
                 ^
prog.c:7:17: note: each undeclared identifier is reported only once for each function it appears in
prog.c:10:12: warning: missing terminating " character
     printf("%2f\n%.2f,c,sum);
            ^
prog.c:10:12: error: missing terminating " character
     printf("%2f\n%.2f,c,sum);
            ^~~~~~~~~~~~~~~~~~
prog.c:10:5: error: expected expression at end of input
     printf("%2f\n%.2f,c,sum);
     ^~~~~~
prog.c:10:5: error: expected declaration or statement at end of input
0 0
prog.c: In function 'main':
prog.c:7:17: error: 'n' undeclared (first use in this function)
     scanf("%d",&n);
                 ^
prog.c:7:17: note: each undeclared identifier is reported only once for each function it appears in
prog.c:10:5: error: expected declaration or statement at end of input
     printf("%.2f\n%.2f",c,sum);
     ^~~~~~
0 0
prog.c: In function 'main':
prog.c:9:5: error: expected declaration or statement at end of input
     printf("%.2f\n%.2f",c,sum);
     ^~~~~~
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>
#include <stdlib.h>

int main(){
*** * ** ** * * ** * * a;
** **** * * ** ** ***** b=0.07;
*** *** ***** * **** *
* *** **** ***** *** ** ** * * * &a);
** * * ** * * ** * * * * ** * *** * a*b);
* * * ** ** * ***
*** * * *** * ** * *** *** ****** * (a*b)+a);
* * * * * * ** ** ****
** * ** * * * *** *** ** * * **
* * *** * * * ** * * 0;
}
100/100 最新回答 用戶: (153 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include ** ** * * *
#include *** * * ** *

int main(int argc, char *argv[])
{

*** ** *** ** ** * *** * a;
**** * ** * ** * * ** ***** b=0.07;
* * * ** * * * *** * **** *** * ** * * *
* *** *** ** ** * * ******** **** **
**** * * ** * * **** ** * *** * **** ***** (a*b)+a);
** ** * *** * ** ************ * * ***** *** *
*** * * * ** *** * * * 0;

}
最新回答 用戶: (220 分)
修改於 用戶:
0 0
prog.c: In function 'main':
prog.c:7:13: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'int' [-Wformat=]
     scanf("%d",a);
             ^
prog.c:9:12: warning: too many arguments for format [-Wformat-extra-args]
     printf("\n",b);
            ^~~~
0 0
prog.c:1:19: fatal error: cstdlib: No such file or directory
 #include <cstdlib>
                   ^
compilation terminated.
0 0
prog.c:1:19: fatal error: cstdlib: No such file or directory
 #include <cstdlib>
                   ^
compilation terminated.
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>
#include ********* ** *

int main(int argc, char *argv[]) {
* * ** *** *****
** * * * *** ** * *** * * * p,tax,total;
* * * * *** * * **** ** *** &p);
* * * * * * * ** ** ***
* * ** *** * * * * *** *
* * * ** ************* ** **** * tax);
* * * * * * * * ** ** * *
* * ** * * * **** **** ** *****
* * * ***** **** **
    * * * ***** ****
** ** * ** **** * *** *** 0;
}
100/100 最新回答 用戶: (221 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 喜歡 0 不喜歡
內容已隱藏
**** *** ***

int main () {
* **** **
* ** * a; ** ** * **** * *** **
*** * ********** * ** * %0.2f\n", a*0.07);
*** * ** * * ** * ** * ** * * * **** * * ***
** * * ** * * ** * 0;
}
最新回答 用戶: (183 分)
0 0
prog.c: In function 'main':
prog.c:7:14: warning: spurious trailing '%' in format [-Wformat=]
      printf("%\0.2f\n",a+a*0.07);
              ^
prog.c:7:15: warning: embedded '\0' in format [-Wformat-contains-nul]
      printf("%\0.2f\n",a+a*0.07);
               ^
prog.c:7:13: warning: too many arguments for format [-Wformat-extra-args]
      printf("%\0.2f\n",a+a*0.07);
             ^~~~~~~~~~
0 喜歡 0 不喜歡
內容已隱藏
* * * *** ** * **
#include ** ** *** *** * * *

int main () {
* ****
* *** * ** ** a; ** * * * * * *** **** * *
* ** ** * * *** * * ** * * * %f\n", a*0.07);
***** ** * ** **** ** * *** * * *** * * * *** * ***** * *
* * *** *** * **** **** 0;
}
最新回答 用戶: (183 分)
0 0
prog.c: In function 'main':
prog.c:8:15: warning: unknown conversion type character 0xc in format [-Wformat=]
      printf("%\fn",a+a*0.07);
               ^
prog.c:8:13: warning: too many arguments for format [-Wformat-extra-args]
      printf("%\fn",a+a*0.07);
             ^~~~~~
0 喜歡 0 不喜歡
內容已隱藏
#include * ** * * **
#include ** *** ** ** ****

int main(int argc, char *argv[])
{

*** * *** * a;
 
** * * * *** **** **
*** ** * *** * * * *
***** ***** ** ** * * * * * *
* ** * *** * **** ** * * * * * ** ** ** *** ** * ** *** **
* * ** * * ** ** * * *** * *** *** * *  
* ** * ** ** 0;
}
100/100 最新回答 用戶: (273 分)
修改於 用戶:
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:104.23.197.64
©2016-2026

相關問題

0 喜歡 0 不喜歡
21 回答
[考試] 最新提問 1月 13, 2018 分類:Final examination | 用戶: nat236919 (5.9k 分)
ID: 41968 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 8.1k 瀏覽
0 喜歡 0 不喜歡
30 回答
[考試] 最新提問 1月 13, 2018 分類:Final examination | 用戶: nat236919 (5.9k 分)
ID: 41942 - 從幾時開始: 無限制 - 到幾時結束: 2018-01-17 16:30
| 9.3k 瀏覽
0 喜歡 0 不喜歡
26 回答
[考試] 最新提問 1月 13, 2018 分類:Final examination | 用戶: nat236919 (5.9k 分)
ID: 41937 - 從幾時開始: 無限制 - 到幾時結束: 2018-01-17 16:30
| 4.8k 瀏覽
0 喜歡 0 不喜歡
21 回答
[考試] 最新提問 1月 13, 2018 分類:Final examination | 用戶: nat236919 (5.9k 分)
ID: 41935 - 從幾時開始: 無限制 - 到幾時結束: 2018-01-17 16:30
| 3.7k 瀏覽
0 喜歡 0 不喜歡
23 回答
[考試] 最新提問 1月 13, 2018 分類:Final examination | 用戶: nat236919 (5.9k 分)
ID: 41926 - 從幾時開始: 無限制 - 到幾時結束: 2018-01-17 16:30
| 4.3k 瀏覽
12,783 問題
183,442 回答
172,219 留言
4,824 用戶