1. Write a C program that asks the user to enter a U.S dollar amount and then shows how to pay that amount using the smallest number of $20, $10, $5, $1, quarters, dimes, nickels, and pennies.

For example:

Enter a dollar amount: $78.49

$20 bills: 3

$10 bills: 1

$5 bills: 1

$1 bills: 3

Quarters: 1

Dimes: 2

Nickels: 0

 

Pennies: 4

 

2)Write a C program that reads an integer entered by the user and displays it in octal (base 8). The output should be displayed using five (5) digits, even if fewer digits are sufficient. Hint: To convert a number to octal, first divide it by 8; the remainder is the last digit of the octal number. Then divide the quotient by 8 and repeat the process to arrive at the next digit. (Do not use built-in C function to solve this problem. You must code it).

 

For example:

Enter a number between 0 and 32767: 2016

In octal, your number is: 03740

 

 

    • 9 years ago
    Assignment Completed
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      octalconversion.doc
    • attachment
      dollarconversion.doc