1 like 0 dislike
7.5k views

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)
ID: 25482 - Available when: Unlimited - Due to: Unlimited

edited by | 7.5k views

73 Answers

0 like 0 dislike
Hidden content!
** * * ***** * *

int x,y;



int main(void)

{
* * ** * ** *
******** * * ** *** * **
* ** * *** * * *



}
answered by (-336 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>



int main(void){


* * * *** * *** **** ** a,b,c;


*** ** * * **** *** ******* *** enter how many cup of coffee or tea you want.\n");
* * *** * * * * **** ** * ****** **
*** * ** * **** * * * ******* *** * ***** ** ** **
*** ** ** ** *** ** * *** * **** * *
* * ** ***** ** ** *** ** * * * * * ** **** ** *
*** * *** *** * ** ** * * *
* * * * *** * * ** * **** ** * ** ****
* ** * *** **** *** * *** * ** 0;















}
answered by (-301 points)
0 like 0 dislike
Hidden content!
#include ** * ** * * *



int main()

{
* * * * ******** **** *** coffee = 0;


*** * ** ** ** * ** *** * * tea = 0;


******* **** *** total_price = 0;


****** * *** *** * * **


** *********** ** * * * * * * * * * **


* ** *** * **** ** * *
* ** * * * ***** ** ***** ** * * * *** *


* * * ** * * *** * ** * = 35 * coffee + 25 * tea;


* * * * * * * * ** * *** * * *** total_price);

}
answered by (-285 points)
0 like 0 dislike
Hidden content!
** ** ** ****** * *



int main(void){


* * ** * ** ** **** * * * a,b,c;


** *** * * ** * enter how many cup of coffee or tea you want.\n");
** ** ** * ** * *** * ** * **** *** * * *
* * * * * * *** * ******* *
** ** * * * * ** ** * * ** * * * **
* ** * * * **** * * ****** *** * **
* ** * * * * *** * *** **
** ** ** ** * * ***** * *** * total is:%d",c);
* * **** ** *** ** * * * 0;















}
answered by (-301 points)
0 like 0 dislike
Hidden content!
* * **** *** * *



int main()

{
* * * ** * * ********** coffee = 0;


* *** ** * * **** * ***** tea = 0;


* * *** **** ** * * * * * = 0;


** ** **** *** ** * ** ** ** **** input the number of coffee ******* **


* * ** *** * * * * *** ** * * * *** * *


*** * * * * * ** * *** ** * * ** ** input the number of tea * ***** *


** *** ** ** *** *** * * * ******** *** * ** ***


** * * ** * ** **** * ** * * ** = 35 * coffee + 25 * tea;


* ** * * ** ** * **** * * * * ** * * price = * * *** * * ** *

}
answered by (-285 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

int main()

{
* *** ** * * *** * c,t;
** ***** * ***** * ** * **** * * * * ** * * *** *****
** * *** ** * * ** * * * *** *** *** ** *
* ** ***** * * * * ** * 0;

}
answered by (-255 points)
0 like 0 dislike
Hidden content!
** * * ***** ** ***



int main()

{
** * ******* ** *** **** coffee = 0;


* *** ** *** ** * * * ** * tea = 0;


* * ** * ****** * * **** total = 0;


* * ** * ** * * ** * * * input the price of a cup of ****** ** *


** ** * *** * * *** **** * **** * * ********


**** * * * ** ** * * *** * * * * * input the price of a cup of *** ***


** * **** * ** ** * ** * * **** ** *** * **


* * *** ******* * = coffee + tea;


*** * ** * * *** * **** ** * * * = * * ** * *

}
answered by (-285 points)
0 like 0 dislike
Hidden content!
*** * ***** ** *
* * * ** * * 35
* 25

int * *

{
****** ** coffee, tea, price;
* * **** * *** ****** * * * * * * * * **
****** * ** ** ** ** *****
* * ** *** ** * * = coffee * * * * + tea * **
* * *** ** *** ****** * **** price);
* ** * ********* 0;

}
answered by (-196 points)
0 like 0 dislike
Hidden content!
* ** * * * * * **

#define * *** 35

#define CUP_OF_TEA 25



int main(void)

{
* * *** ** * *** a,b,TOTAL;
* *** * **** ** * ** *** *** * **** * ** *
* ** * **** * ** * ** * *** * **** * ** ** ** ** * * *** * *
* ** ** *** * * ***** * * *** 0;

}
answered by (-498 points)
0 like 0 dislike
Hidden content!
*** * ** ** ** * ***
** *** * 35
* * 25

int *** ***

{
* * ******** ** * tea, **
*** * * * *** * ** ** the number of coffee cups: * **
*** ** * * * **** ** * * * * *** * **
* **** * * ** * * ** * ** the number of tea cups: * * ***
** ** ** * * * ** * * * * * * ***
* *** * ** * = coffee * ** *** * + tea * ** * ***
***** * * * ** * ** ***** ** *** *
** ** * ** 0;

}
answered by (-196 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.59.91
©2016-2025

Related questions

4 like 1 dislike
61 answers
[Exercise] Coding (C) - asked Sep 28, 2017 in Chapter 2: C Fundamentals by thopd (12.1k points)
ID: 25484 - Available when: Unlimited - Due to: Unlimited
| 6.6k views
2 like 0 dislike
50 answers
[Exercise] Coding (C) - asked Sep 28, 2017 in Chapter 2: C Fundamentals by thopd (12.1k points)
ID: 25483 - Available when: Unlimited - Due to: Unlimited
| 5.8k views
12,783 questions
183,442 answers
172,219 comments
4,824 users