6 like 1 dislike
1.6k views

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.9k points)
ID: 25954 - Available when: Unlimited - Due to: Unlimited

edited by | 1.6k 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
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.7.60
©2016-2025

Related questions

6 like 0 dislike
2 answers
[Normal] Coding (C) - asked Oct 16, 2017 in Introduction to Computer Programming I (C) by thopd (12.1k points)
ID: 27175 - Available when: Unlimited - Due to: Unlimited
| 1.4k views
6 like 0 dislike
3 answers
[Normal] Coding (C) - asked Oct 16, 2017 in Introduction to Computer Programming I (C) by thopd (12.1k points)
ID: 27167 - Available when: Unlimited - Due to: Unlimited
| 1.4k views
5 like 0 dislike
3 answers
[Normal] Coding (C) - asked Oct 10, 2017 in Introduction to Computer Programming I (C) by admin (9.9k points)
ID: 25955 - Available when: Unlimited - Due to: Unlimited
| 1.7k views
12,783 questions
183,442 answers
172,219 comments
4,824 users