6 like 1 dislike

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.

[Normal] Coding (C) - asked in Introduction to Computer Programming I (C) by (9.8k points)
Available when: Unlimited - Due to: Unlimited

edited by | 25 views
0 0
excellent

1 Answer

0 like 0 dislike
Hidden content!
*** * ** * **
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 ** * *
***** **
answered by (1.4k points)
0 0
prog.c:2:1: error: return type defaults to 'int' [-Werror=implicit-int]
 main()
 ^~~~
cc1: all warnings being treated as errors
Get it on Google Play Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:162.158.79.179
©2016-2019

Related questions

6 like 0 dislike
2 answers
[Normal] Coding (C) - asked Oct 16, 2017 in Introduction to Computer Programming I (C) by thopd (11.3k points)
Available when: Unlimited - Due to: Unlimited
| 34 views
6 like 0 dislike
3 answers
[Normal] Coding (C) - asked Oct 16, 2017 in Introduction to Computer Programming I (C) by thopd (11.3k points)
Available when: Unlimited - Due to: Unlimited
| 11 views
5 like 0 dislike
3 answers
[Normal] Coding (C) - asked Oct 10, 2017 in Introduction to Computer Programming I (C) by admin (9.8k points)
Available when: Unlimited - Due to: Unlimited
| 18 views
9,012 questions
77,061 answers
52,721 comments
2,239 users