6 like 1 dislike
282 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.

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.

edited | 282 views
0 0
excellent

`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 *** *   ** * ****`