5 like 0 dislike
13.1k 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.

[Exercise] Coding (C) - asked in Chapter 4: Expressions by (12.1k points)
ID: 25731 - Available when: Unlimited - Due to: Unlimited

reshown by | 13.1k views

69 Answers

0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <stdlib.h>



int main()

{
** ** * ** ** * * * a,b,c,d,e,f,g,h;
** * * * ** ***** ** **** * **** *
**** *** *** * *** ** * *** *
*** *** * *** * ***
* ** * * *** * **** *** * ** ** ***
*** * * * * * * *** * **** ** *
* * * ** ******* * * ** * *** ** ** ** ****
* * *** ** **** **** * * * ***** * *
** ** * ** **** **** ** ** ** * * *** ** *
* * * * **** * * * * ** ** ******* * * bills:%d\n",b);
****** * **** ** ** * * * * ** ** bills:%d\n",c);
* *** * * ** ** ******** ** ** * bills:%d\n",d);
*** ******** ** * ** ** * ** * * * bills:%d\n",e);
** ** *** ****** * **** ** ** * **** bills:%d\n",f);
* * ** ** **** * * * ** *** * bills:%d\n",g);
*** * ***** * * * **** *** ***** *** ** * * * ** *
** * * * * ** * ** *** 0;

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



int main(void){


* ** * *** *** * **** * a,b,c,d,e,f,g,h;


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


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


** * * * ** * ***** *** * bills:%d\n",b);
****** * * ** ** ** * *** **** * * bills:%d\n",c);
** * *** * * * ** ** * ** * *** bills:%d\n",d);
**** * * * ***** *** * * bills:%d\n",e);
***** * * * ***** ** * *** * *** bills:%d\n",f);
* * * * * ** * * ***** *** * ** **** ******
* * *** * * *** ***** * *** *** * bills:%d\n",h);











return 0;



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

int main(void)

{
** * * * * * **** ***** a;
*** * * ** * * th, fh, oh, fif, ten, five,one;
* * ** * * * * ** * **** &a);
* ** * * *** **
* * ** = a %1000;
*** * * ***** *
* ** ** **** * = a%500;
*** * * ** ****
*** ** ** a%100;
* * **** *** *
*** **** * ** a%50;
**** ******* * * *
* * ***** ** = a%10;
* * ** ** *
** * *** **** = a%5;
* * * ****** **
* *** * a%1;
** ** * ** **** * ******** **** *** * ** * **** ** * * *** * * * ****** * * ** * *** * * *** * ******** ** fh, oh, fif, ten, five,one);
** ***** **** * **** * 0;

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

int main(void)

{
*** ****** * *** ** ** ** * a;
* **** *** * ** *** * ** th, fh, oh, fif, ten, five,one;
** * **** *** ** *** * * *** * * * * * *
* ** ** *
* **** * = a %1000;
****** *** *****
*** * ** * *** = a%500;
* ***** ** * *
** ** ** ** a%100;
** * ** ** ** * * *
* **** ** * a%50;
* *** *** * ** *
** * ** * = a%10;
* **** * ****** * *
** * * ***** = a%5;
* *** * * * * * **
* ** ** a%1;
** ** * **** * * ** **** ****** * 1000 * * 500 * * * 100 ** * 50 *** * 10 ****** 5 ** ** 1 * ** **** * * fh, oh, fif, ten, five,one);
**** * * * ** * * 0;

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

int main(void)

{
* *** * *** * * a;
***** * * * *** *** * ** th, fh, oh, fif, ten, five,one;
** ** ** * * * * ** * * ** ***** * *** ***
*** * * * ** * *
** = a %1000;
* ***** * *** *
** *** ** = a%500;
* ** *** * ** *
*** ** * a%100;
* * * ** * **
* * * * * a%50;
* * *** * * **
*** **** * * = a%10;
* ** * ** **
* * ** ** * ** = a%5;
*** * ** ** *
** * ** a%1;
* ******* **** ****** * ** 1000 ** *** 500 ** 100 ** ** 50 ** * * 10 * ** 5 ** * 1 * ** ** * * fh, oh, fif, ten, five,one);
** ** * ** ** **** ** *** 0;

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



int main()

{
* * *** ** ** **** ****** a,b,c,d,e,f,g,h,x;
* * * **** **** * ** * * ** * ** ** **
***** * **** ** *****
********** *** * * ** *** * * bills:%d\n",b);
** * * *** **** ***
* *** * * * * ****** ** **
**** ** * ** * *** * *** ** * ****** bills:%d\n",c);
** ** * ** ** * * * **
* *** * * * ******* ***
** * ***** * ** * * * ***** bills:%d\n",d);
* * ** * ** *** * **
* * * ** * *********** ****
*** * *** * * * * **** ** ******* * bills:%d\n",e);
* * * ******* *** * *
* * ** ** * * ** ** *** **
* ** * * * **** * * *** * bills:%d\n",f);
** * *** ** *** *
***** * * ** ** * * * *
* * * ******** * * ** ** * bills:%d\n",g);
** * **** *** **** *
**** * ** * * * *
** * * ** *** ** ** * * *** bills:%d",h);

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



int main()



{
* * * * * ** * *** a, ONET, FIVEN, HUNDRED, FIFTY, TEN, FIVE, ONE;


* *** * * * *** * * * * ** ***** ** &a);


* ** * * ** *** = a/1000;
* ** *** *** * * ** * = (a-ONET*1000)/500;
** ** * * ** ******** * *** * = * **** ** *
**** ** *** * ****** * ** = * * ** ** * * ****
***** ** ** * **** *** * = * * *** * ***** **
* * *** ** ***** * * * *** = * ******** *** * * * *
* * * *** ** **** * ** = * * *** * *** *** ** * ** ** *


* ** *** **** ** **** *** * * ** ** * * * bills:%d\n",ONET);
** ** ** * * ***** * * ** ** * ** ** * *** ** * * ***
* * ** ** * * ** ** * * * * * ***
* *** * * ** * ** * ** ** * * bills:%d\n",FIFTY);
* * * *** * ** * ** * * * *** * bills:%d\n",TEN);
*** *** * **** * * * * * bills:%d\n",FIVE);
* ***** * * **** * ** ** * * bills:%d",ONE);

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



int main()

{
** *** ******* * ** a,b,c,d,e,f,g,h,x;
* * **** * * **** * *** ** * * ****** *** ****
* *** ** * ** * * ** ****
** ***** * * ** * * * ****** * ** * bills:%d\n",b);
*** * * * ** * ** *
* * * * ** * * * ** **
* * * * *** * **** *** * ** ** * bills:%d\n",c);
* * * * * *** * ***
*** * * * ** ** * * ** * *
** * *** *** ****** * * * *** bills:%d\n",d);
*** *** * ********* ** *** *
**** * * *** * ** * * ***
** *** * **** * * * * * *** * *** bills:%d\n",e);
* *** * * ** ** * **
** * ** * * * *** *** ** **
* ** ** **** ** * * *** ** ** bills:%d\n",f);
*** * *** * * ****
* ******* * ** ****** **
*** * ** ** *** * * ** ** * * * ** bills:%d\n",g);
* *** * ***** *** **
** ****** ** * ** ***
* * * * *** *** * * * * ** * **** bills:%d",h);

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

#include * * **** **



int main()

{
*** * ****** ** * **** money = 0, b;


** **** **** ** * ** * ** * ** * ** &money);


* * ** * * **** * = money / 1000;
* * * * * ** * * ** * = money % 1000;


* * **** ** * ** **** ** ** ******** * ** ***** * b);


* **** ** ***** * = money / 500;
* * ** *** *** * * ** * * = money % 500;
**** * ** * ***** * ****** * * b);


* ** ** *** **** * * * = money / 100;
* ** * * ** ** ***** * * = money % 100;
* ***** * **** ** * * * ** ** ** *** ** **** ** b);


* ** ** *** ******* * ** ** = money / 50;
* ** *** * ** ** **** * = money % 50;
** * * * ** ** ** * * * *** **** *********** * b);


*** * * ** ** * = money / 10;
***** ** * * ** ** = money % 10;
** * ** * *** * ** * * *** * * ** * * b);


** * * * ** * * = money / 5;
* ** ** * * * **** * *** = money % 5;
****** * ** * ** ** **** * * ** **** * *** * * b);


* * ** * *** * ** = money / 1;
** *** * * *** * * ** * = money % 1;
**** * *** ** * * ** * * ** * * * ** ** * *** b);
* ** * **** **** 0;

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



int main()

{
*** ** * * ** a,b,c,d,e,f,g,h,x;
**** **** * *** * * * * *** * * * * * *
************ * ** * ****
** * *** ** * ** *** * * * * * bills:%d\n",b);
** ** * * * * ** *** * **
* *** * ** * ** * ** *
* * ** * * *** * ** * ** ** * bills:%d\n",c);
* * * ** * *** *
*** ** ** **** * ** * **
*** * ** * * * * * * * * * ** bills:%d\n",d);
** * ** * ** *
*** * * * * * * * ** * **
* ** * *** * ********* *** ** * * bills:%d\n",e);
* * * * ** * *** *** ** **
* *** * ***** ***** ** ***
** * * * * * ** * * ***** * * * *** bills:%d\n",f);
* * * *** ** **** * **
* *** ** ****** ****** * **
* *** * ** * * ** *** **** ** * ** bills:%d\n",g);
* **** ** ** * ** *** **** *
** ** ** *** **** * * * ***** *
* * * * * * * * **** * * ** bills:%d\n",h);



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

Related questions

1 like 0 dislike
0 answers
[Resource] asked Oct 14, 2017 in Chapter 4: Expressions by thopd (12.1k points)
ID: 26949 - Available when: Unlimited - Due to: Unlimited
| 15 views
12,783 questions
183,442 answers
172,219 comments
4,824 users