6 喜歡 1 不喜歡
1.3k 瀏覽

Write a program that input a New Taiwan Dollar amount and then shows how to pay that amount using the small bills of $1000, $500, $100, $50, $10, $5 and $1.

將台幣現鈔換成1000, 500, 100, 50, 10, 1 元零錢

Example input:

763

Example output:

NT$1000 bills:0
NT$500 bills:1
NT$100 bills:2
NT$50 bills:1
NT$10 bills:1
NT$5 bills:0
NT$1 bills:3

Hint: Divide the amount by 1000 to determine the number of $1000 bills needed, and then reduce the amount by the total value of the $1000 bills. Repeat for the other bills sizes. Be sure to use integer values throughout, not floating-point numbers.

[正常] Coding (C) - 最新提問 分類:Introduction to Computer Programming I (C) | 用戶: (9.9k 分)
ID: 25954 - 從幾時開始: 無限制 - 到幾時結束: 無限制

修改於 用戶: | 1.3k 瀏覽
0 0
excellent

1個回答

0 喜歡 0 不喜歡
內容已隱藏
** **** ****
main()
{
**** * ** * int money, a, b, c, d, e, f, g, h, i, j, k, l;
** * * * * * * * * input Taiwan Dollar * ** ***
*** * ** * ** ** * * ** * * * **** *
* * * * *** *
* ***** * * ** ** * bills: %d ** *
* * *** * **** ** *
*** ** * *** ***
*** * * * **** * * * * bills: %d * ** *
*** * ** *
* * * *** *
* * * * ** * ** ** ** ** * bills: %d *** *** *
** **** * **
** *** g=f/50;
**** * * * ***** ***** bills: %d * *** ***
*** * * * * * * *
** *** * ** * i=h/10;
* *** * ** * ****** ** bills: %d ** ***
* * *
**** *** * k=j/5;
** ** ** * * ** ** bills: %d ** ** **
***** * * * * * **
*** ** * * *** *
* *** *** ** * * * * **** * * *** bills: %d ***** ** *
* * ** ***** else
* * * * * * * ** * * ****** bills: 0 * * * **
****
最新回答 用戶: (1.4k 分)
0 0
prog.c:2:1: error: return type defaults to 'int' [-Werror=implicit-int]
 main()
 ^~~~
cc1: all warnings being treated as errors
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.80.153
©2016-2025

相關問題

6 喜歡 0 不喜歡
2 回答
[正常] Coding (C) - 最新提問 10月 16, 2017 分類:Introduction to Computer Programming I (C) | 用戶: thopd (12.1k 分)
ID: 27175 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 1k 瀏覽
6 喜歡 0 不喜歡
3 回答
[正常] Coding (C) - 最新提問 10月 16, 2017 分類:Introduction to Computer Programming I (C) | 用戶: thopd (12.1k 分)
ID: 27167 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 1k 瀏覽
5 喜歡 0 不喜歡
3 回答
[正常] Coding (C) - 最新提問 10月 10, 2017 分類:Introduction to Computer Programming I (C) | 用戶: admin (9.9k 分)
ID: 25955 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 1.2k 瀏覽
12,783 問題
183,442 回答
172,219 留言
4,824 用戶