1 like 0 dislike

Write the C program that receives the number of coffee cups and teacups. The program shows the TOTAL price after user press Enter. The price for one cup of coffee is $35, one cup of tea is $25 

寫一個計算咖啡跟茶的總計

Example input:

3 2

Example output:

155
[Exercise] Coding (C) - asked in Chapter 2: C Fundamentals by (9.9k points)
Available when: Unlimited - Due to: Unlimited

edited by | 637 views

73 Answers

0 like 0 dislike
Hidden content!
#include<stdio.h>

int main()
{
* *** **** *** * * * cup_tea;
** * * ** ** * ** cup_coffee;
* * ** * ** * total_price;
** ** * ** *** * ******* ****** * * * * * ** *
* ** *** ** ** ** *** *** * *** *** * ***** *
* ** ** ** *** * * * ***** ** ** *** *** *
***** ***** * *** * *** 0;
}
answered by (82 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
* * *** *
int main ()
{
* * * * * coffee,tea,total;
* * * * * *
* * * * * ** ** ** * * ** ** ** ***** * *
** * * * *
** ** * ** * **** (coffee*35) + (tea*25);
*** ** * **
* * * * *** * ** *** **** *
** * ** 0;
}
answered by (-167 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
** ** * *** * *** *
int main()
{
** *** **** ** ** * * * coffee,tea,total;
** * * ***** ** * *** *** * ** &coffee,&tea);
** * * ** * ** ** *** * tea*25;
** ** * * ***** * ** ** ** ******
* *** **** * ***** * **** *
* ** * * * *** * ***** * **** * * * * **** total);
* ***** * **** ** * *** * * 0;

}
answered by (-254 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
int main(void)
{
* ** ** ** *** * *** ** coffee,tea,total;
* * * * * ** ******* ** ** * &coffee,&tea);
*** * *** **** * * *** * tea*25;
*** ** * ** * ** *******
*** *** *** * *** * ****** ** *
* **** * * ** * ** * * * *** * * * ** total);
* * **** * * ** * *** * 0;

}
answered by (-254 points)
0 0
prog.c: In function 'main':
prog.c:4:5: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
     scanf("%d%d", &coffee,&tea);
     ^~~~~
prog.c:4:5: warning: incompatible implicit declaration of built-in function 'scanf'
prog.c:4:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
prog.c:8:5: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
     printf("%d", total);
     ^~~~~~
prog.c:8:5: warning: incompatible implicit declaration of built-in function 'printf'
prog.c:8:5: note: include '<stdio.h>' or provide a declaration of 'printf'
0 like 0 dislike
Hidden content!
***** ** ** * * *
int main ()
{
** ** *** * coffee,tea,total;
* *** * *** **** *
* ** * * * ***** ** *** * * *** * ***
******** **
* *** * *** * * (coffee*35) + (tea*25);
* **** *
*** * * * ****** ** * * **
* * ** * ** 0;
}
answered by (-167 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 like 0 dislike
Hidden content!
** * * *** *** * *
int main(){
** * **** * * * * *** a,b,total;
* * * * * * ****** ** *** * *** ** * *
***** *** * *** ** * * *** * *****
**** ** *** ** * ** * * * * ** * *
return 0;}
answered by (-32 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
** ** * ** * ** **
int main(){
* ** ** * * * ** ** a,b,total;
* * * * ** * * ***** * * * * * *** * **** ***
* **** ***** * * ***** * **
* ** * ********** * * * * * * * ** ***
return 0;}
answered by (-32 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
**** * * ** **
int main(){
* * * ** * * *** * * a,b,total;
*** * * ****** ** **** ****** ** ** * ** * ***** ** ***
** *** * ** *** *** * *
* * * * * ** ** *********** * ** ** * * * *
return 0;}
answered by (-32 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
** *** ** * * * *
int main(){
** ** * * ** * * ******* a,b,total;
**** ****** **** * *** *** * * ** * **** ** * * ** * *
** *** * * * * * * ** * **
** ** ** * ** ** * * * * ** * **
return 0;}
answered by (-32 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
* ** * * * * **
int main(){
* ** ** *** ** * ** * * a,b,total;
** * **** ** * * ** * * * * ******* * ** * ********
* * ** * * * * * * *
* * ** ** * * * * ** ** *
return 0;}
answered by (-32 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Get it on Google Play Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.63.111
©2016-2021

Related questions

4 like 1 dislike
61 answers
[Exercise] Coding (C) - asked Sep 28, 2017 in Chapter 2: C Fundamentals by thopd (12k points)
Available when: Unlimited - Due to: Unlimited
| 685 views
2 like 0 dislike
50 answers
[Exercise] Coding (C) - asked Sep 28, 2017 in Chapter 2: C Fundamentals by thopd (12k points)
Available when: Unlimited - Due to: Unlimited
| 535 views
11,166 questions
132,618 answers
131,288 comments
3,823 users