5 like 0 dislike
10.7k 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 | 10.7k views

69 Answers

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

int main(){

  int a;
* * * *** ** ** * *** * **

  int thousand_num=a/1000;

  int * ** ** ******** **

  int ** * ** * *** * ** *
*** * * * * ** ***** * * *
** ** * * ten_num= * * *** * * *
**** ** ** * five_num= * * ** * * * *
* * ** *** one_num= ******** * **
* ***** * **** **** ********* * * ** ***
*** * * * *** * * ** * * ** ** * *** **
*** * * ** ** * * * * * ***** * **
** *** ** *** * ** * *** *** * * * * * *
*** * * ** * ** * * ** * * ** *
* * *** ** * ** * * * * **** ***
** * *** * ** * ** * * *

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

 main (void)
***** *** *
* * ** * ** x,y;
* * * * * *** *** * * ** * ** * * * * *


* ** * * * **
******** ** *** * * bills:%d",y);

  x = x%1000;


* ** * ** * ***
** ** ** *** *** * * *** * bills:%d",y);
*** *** * = (x%500);




** * ****** **
* * * * *** ** *** * *** * **
* * ** * = (x%100);


**** *** *
* * ** * *** ** ** ** * **
** *** ***** ** = (x%50);




****** * * *
** * * * * **** **** * * ** ** * ** **
* ** * * = (x%10);


* * * ** * *
* * * * * * ** ** * *
* * ** * *** = (x%5);


* **** ** **
** * * * **** *** *** ***
*** ***** * = (x%1);
* ** * * * ** * **** 0;
** *** **
answered by (-140 points)
0 like 0 dislike
Hidden content!
#include *** ** ** * *

 main (void)

  {
** * ** * * x,y;
** * * * * ** ** ** * ** **


*** * **** *
* ** **** * ******* * *** * ** ** *
*** * * ** ** = x%1000;


* * * *
** * * * ** *** * * * ** * bills:%d",y);
* *** * * * = (x%500);




*** * * * *
* * * *** * ** * * * **** bills:%d",y);
* *** * * = (x%100);


* * *** ** * *
* * **** * *** ** * * * * ** ** *
** **** * *** = (x%50);




**** ** ** * *
*** * * ** ** *** ** **
** * *** ** = (x%10);


* * * *** * *
* ** *** * * *** * * * * * **** *
*** * ** * * = (x%5);


* ** * *** *
*** **** * * ** * * * * * *
* * ***** = (x%1);




*** ** * ****
***** * * * 0;
** ****
answered by (-140 points)
0 like 0 dislike
Hidden content!
* * * **





int ***



{



int amount;




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



int * * ** *** * **

amount = amount %1000;

int * ** ** *** * ** **
** * ******* ** **

int *** ***** * * *

amount= * *

int **** *** * ** ** *

amount= **

int *** ** * ** ;

amount= ***

int ** ** *** ** **

amount= * ****

int ***** ** ** ***

amount= * * *


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









return 0;

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



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",g);
*** ****** ** * **** * * * * * bills:%d",h);




* ** * ********* * ** ** ** 0;

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



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",g);
* * * * * ** *** * ** ** * ***** * * Bills:%d",h);




** *** ** * *** * * * * *** 0;

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

int main()

{

  int a;
* ** * * ** * ** * * * *** * ***
* * * * ** k,l,m,n,o,p,q;
* ** *** * * *
* * ** *** * * ** *
*** **** * * * * ** * * * **
* * **** * ** **** * ** *
* ** * * ** * ** * * ** * ***
* ** * ** ** * ** ********* ** * *** *
* * * * * **** ** * ** * *****
* * ** *** *** *** ** ** * * * * *
*** *** * ** * **** * * * * *
** *** * *** * * * * * bills:%d\n",m);
******* *** * ***** * ** bills:%d\n",n);
*** ***** ** * * * ** bills:%d\n",o);
** *** * * ** * bills:%d\n",p);
*** * ** * * * * * ** ** bills:%d",q);



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



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",g);
* ****** * ** ** * * ** * **** ** Bills:%d\n",h);




* * * * * ** * ** * 0;

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



int main()

{

int * * * * **** *


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



thou=a/1000;

fhd=(a%1000)/500;
* * * *****
** ** ** *
*** * * ** *
* * *** * * *
* * **** **


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

printf("NT$1 ****** * ** *



return 0;

}
answered by (-249 points)
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",f);
* *** * ** * ** * ***** * ** ** bills:%d\n",g);
** ** * * *** ** * ** *** *** * *** bills:%d\n",h);


***** * * * ** * ** * * ** 0;

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

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