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

69 Answers

0 like 0 dislike
Hidden content!
#include * *** ***



int main()

{

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

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

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

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

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

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

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

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

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

* * * * * * ** ** **** * ******* ** * bills:%d\n",b);

** *** * * ******* * * * ****** bills:%d\n",c);

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

* ** ** * * * **** ** *** * * bills:%d\n",e);

**** ********* ** * **** *** ** bills:%d\n",f);

*** *** * * * ******* * * * ** bills:%d\n",g);

** * * * * *** * ** * bills:%d\n",h);



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

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

int main(void)

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

b=a/1000;

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

return 0;















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

 int main ()

{
* * **** *** *** * * *** a;
* * ** * ** * *** * one_thousand;
** * * ** ** * * **** five_thousand;
* * **** ** *** * * * one_hundred;
* **** **** * * * fifty;
* * ***** *** * ** ** ten;
** * ** *** ** * ** * * five;
*** * ** ** ** * ** one;
***** ** * * ** *** * ** * * ** * ** *** * &a);
* * ** * * * * * * ** *
* ******* ** ** * ** ** *** *** **** * *
* ** * * ** * * * ** * ** * *
* * * ** ** * * * * *** ** * ******
* * ** ** **** * ** **** ****** ** * * **
* * **** * * * * * ** * * * **** *** ** ***
* ** * * * ***** ** * **** **** ****** **
* ** ** * * * * **** ** ** ** ** * bills:%d\n",one_thousand);
** * * * * ** * * ** * ****** ** * ** * **** ***
* * * ** ***** ** * *** * bills:%d\n",one_hundred);
* ** ***** ** ** * **** ***** ** * bills:%d\n",fifty);
* * ***** *** *** * ** bills:%d\n",ten);
** * ** ** *** *** ** * * * * bills:%d\n",five);
** ** * * * * * *** * * bills:%d\n",one);
** ** * * ** * * *** 0;



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

 int main ()

{
******** ** * ** * ** *** a;
****** ** * ** *** * * *** one_thousand;
* ********* *** ****** * ** five_thousand;
* ** * ** *** * ** ** one_hundred;
* *** ** ** ** fifty;
** * ****** ** * * ** ten;
*** **** * **** * * ** five;
* *** ***** ** *** * * one;
*** **** ** * ***** * * ****** ** &a);
** ** * * ** ** * ** **
**** * ******* * * **** * ** ** *** *
** ** * * ** * ** * * * * *****
**** ****** **** * * * * * **** **
** * ** * * * **** * * *** ** * *
*** ** * ** ** * *** ** **** **** * **** ***
*** ** * * * * ** **** * * *** ***** *
* **** * *** ** *** * * *** * ** bills:%d\n",one_thousand);
** ***** *** * *** ** * * * * * ** * ** ** *********
* * * ** * * * * ** * * * bills:%d\n",one_hundred);
* ** ** ** * * * * * * **** * bills:%d\n",fifty);
**** * * * * * *** * ** *** bills:%d\n",ten);
***** *** ** ** *** * * * **** * bills:%d\n",five);
* * *** ** *** *** ** * * bills:%d\n",one);
** ** ** *** *** * * 0;



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

int main(void)

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

a=763;

b=a/1000;

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

return 0;















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

int main(void)

{
* ***** ****** * ** * * ** * *** * * * * * * * ** ** **
* * * ** * * ***** * * ** * *****
** **** *** ** * ** * = a/1000;
* * * * ** * * ** ** * *** = (a%1000)/500;
** ** * ** ** ** * ******** = ((a%1000)%500)/100;
* * **** * * * = (((a%1000)%500)%100)/50;
** * * ** * * ** * ** = * *** **** ***
* ** * ** ** * ** * = ** * ** * * * *
* *** * ** ** * * = * ********** ******
** *** * * * ** ** * * * * ****** ** ** *
* ** ***** **** * *** *** * * * * * ** * * ** ** **
*** *** *** *** ** * **** *** * *** * * * * **
** * **** * ** ** * * * * *** *** * bills:%d\n",fifty);
** * * ** ** * * * * * ** * bills:%d\n",ten);
* * ** * * * *** *** ** bills:%d\n",five);
***** *** * *** ** * ******* bills:%d",one);
** ** **** **** ***** 0;



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

#include ** ** ** *

#include <math.h>

int main(void)

{
* * ** * **** *** ** * price,i,a,b,c,d,e,f;
* * ***** ** ** *** *** * * *
******* * * *** * * ** * ****
* *** * * ** ** ** *

  {


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

  }
* ** *** **** * ***

  {
* **** ** * *** * *** *
** ** * * ** * * *** * * * * *** * * * * ***

  }
* ** * * ** * * * **

  {
* ** * *** * * * * * ** ** * * **
* * *** * *** *** * ** **** *** *

  }
** * * ** ** * ** *

  {
* ***** ** * * ** * *
** * * *** ** * * ** * **** * *** * *

  }
* * * * * **** **** ***** *

  {
* * * ***** *** * * * **
*** ** * * * * * *** * * **** * **** *

  }
***** * * * * ** ** ** ** * **

  {
** *** **** * ** * * ** * * * * ****
*** ***** *** * * *** * * * * * ****

  }
* ** * * ** *** * ** ***** *

  {
* ***** *** * ** ***** * ** * ***
*** ** ** * * * **** * ****** **

  }
*** *** ******* bills:%d\n",i);
* * * * ** ** * **** ** * ***** * ***
** * **** ** ** *** * * * * * *** ** bills:%d\n",b);
* * * ** ** **** * * * *** * * * * * * *** **
* ***** ** ** * * *** ** * * ** * * * * *** *** ***
** * * ****** * **** *** * *** * * **** *** ** ** * ** ***
* * * **** * *** ** * * *** ** ******* ** * ** * * * * ** ** **
** ***** ** * * * 0;

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

#include <stdlib.h>



int main()

{
* * *** ** * ** *** **** * * a;
* *** * **** ** ** ** ** * * * *** * * * * ** *
* *** ** * *** * * *** *** * *** ** * * bills:%d\n",a/1000);
**** ** * ** * ** * * * **** ********* bills:%d\n",a%1000/500);
** ******* *** * * * ***** ** * * **** * * *** ** *
* *** *** * ** * ** ** ** ** ** * * ** * * * **
* ** ** * **** ** * * *** **** * * * ** * * * ** * *****
** ****** ***** *** ** ******* * ** * * *** * * * ** * ***
** * *** ******* **** ** * ** * * * * ** * ** **** * * *
*** ** **** ** 0;

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

 int main (void)

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


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


****** ** * * ***
**** * ** ***** * ** ** * * **** * * **
** * * = (x%500);




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


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




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


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


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

  x = (x%1);
* * * **** ** * ** * * * 0;
* **********
answered by (-140 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)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:162.159.115.31
©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