1 thích 0 k thích
12.3k đã xem

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) - đã hỏi trong Chapter 2: C Fundamentals bởi (9.9k điểm)
ID: 25482 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn

đã sửa bởi | 12.3k đã xem

73 Trả lời

0 thích 0 k thích
Hidden content!
#include<stdio.h>

int main()
{
* * ** * ** ** * *** ** * cup_tea;
* * **** **** ** ****** * * * cup_coffee;
** * ** ** ** *** ** * total_price;
** * *** *** * * * *** ****** ** ** **** * ******* *
* * * * ** * **** *** * **** * * **
* * **** * ** ***** * ** **** * ** ** * *
* * * * ** * * * *** 0;
}
trả lời bởi (82 điểm)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 thích 0 k thích
Hidden content!
* * ** * * *
int main ()
{
* *** ** * coffee,tea,total;
* ** ** **
* ** * *** **** * * ***** **** * ***
** ** * ** *
* ** * * * * * (coffee*35) + (tea*25);
** * * * *
** *** * * * * * * *** * * *
* **** ** * * 0;
}
trả lời bởi (-167 điểm)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 thích 0 k thích
Hidden content!
*** * * ** * **
int main()
{
* * * ** * **** * * coffee,tea,total;
**** * * * *** * * * ** * *** * *** * &coffee,&tea);
*** * * * * *** * * *** * tea*25;
***** * * *** * ***** **
*** * * * * * ***** * **
*** * * * * * * * *** *** * ** total);
* ***** *** * *** 0;

}
trả lời bởi (-254 điểm)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 thích 0 k thích
Hidden content!
int main(void)
{
*** ** * * * * * ** ** coffee,tea,total;
* * *** * ** * * * * * * ** * * &coffee,&tea);
* ** ****** ***** * *** *** tea*25;
**** * *** * * ** *** * * *
* ** * * ** * ** ** * **** * *
** * * * * * ** * * **** * * *** * total);
* * * * *** *** *** * * * **** 0;

}
trả lời bởi (-254 điểm)
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 thích 0 k thích
Hidden content!
* * * * * *
int main ()
{
*** *** *** coffee,tea,total;
***
*** *** * * ***** *** * ** * *** * ** **
* * **
* * * * * * * (coffee*35) + (tea*25);
* * **
* ** * * ** * ** ** *
* **** ***** * 0;
}
trả lời bởi (-167 điểm)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 thích 0 k thích
Hidden content!
* ** **** * ** ****
int main(){
****** * ** *** *** a,b,total;
* * * **** *** * ** *** ** ** **** * ** * ** **
** * * * * *** * * * ** *
* * * * * ** * * * * **** *
return 0;}
trả lời bởi (-32 điểm)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 thích 0 k thích
Hidden content!
* ** ** *** * *
int main(){
* * * ** * ** *** a,b,total;
*** * ** ****** *** *** ** * *** ** *** ** *** * ** **** **** **
* *** * * * ** ** *** ** **
* * * * ** **** * *** * *** ** *
return 0;}
trả lời bởi (-32 điểm)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 thích 0 k thích
Hidden content!
**** * * * ** ****
int main(){
* * * * ** * * * ** a,b,total;
** ** ** ** * **** *** ** * * * * * ** * *
** * * * ** ** * * ** * ****
* **** ** *** ** *** * **** * ** ** *
return 0;}
trả lời bởi (-32 điểm)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 thích 0 k thích
Hidden content!
***** ***** * *** **
int main(){
** ** ** * * ** * ***** a,b,total;
** ** * ** ***** * * * ** * ** ****** ** * * **
* * * * ** ** * ** * ****
** * * * ** * * ** *** * * * ** * * * ****
return 0;}
trả lời bởi (-32 điểm)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 thích 0 k thích
Hidden content!
* * ***** * ***
int main(){
*** **** ** * * **** ** * * a,b,total;
** ** *** ** ** **** * **** *** * * * **** **** ** ***** **
** * ***** * ** * * * * * * *
* * * * * ***** ***** ** * *** * * * ****
return 0;}
trả lời bởi (-32 điểm)
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.65
©2016-2026

Những câu hỏi liên quan

4 thích 1 không thích
61 trả lời
[Exercise] Coding (C) - đã hỏi ngày 28 tháng 9 năm 2017 trong Chapter 2: C Fundamentals bởi thopd (12.1k điểm)
ID: 25484 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn
| 10.7k đã xem
2 thích 0 k thích
50 trả lời
[Exercise] Coding (C) - đã hỏi ngày 28 tháng 9 năm 2017 trong Chapter 2: C Fundamentals bởi thopd (12.1k điểm)
ID: 25483 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn
| 9.9k đã xem
12,783 câu hỏi
183,442 trả lời
172,219 bình luận
4,824 thành viên