Computer Programming with Engineering Applications

profileq8.l
assign1.pdf

CS 2073

Computer Programming with Engineering Applications

Assignment 1

1. (100 pts) Write a program that computes the total amount of money in dollars and

cents when the number of pennies (1 cent), nickels (5 cents), dimes (10 cents) and

quarters (25 cents) are given. Sample execution of the program is given below.

Enter the number of pennies, nickels, dimes and quarters

1 2 4 5

You have 1 dollars and 76 cents

Pay attention to the following

(a) Name your file assign1.c

(b) Use integer division to find the number of dollars.

(c) Use mod operation (%) to find the number of cents.

(d) Test your program with the following cases. Output should match the output

given after the →.

• 1 1 1 1 → You have 0 dollars and 41 cents • 18 8 4 2 → You have 1 dollars and 48 cents • 10 2 8 4 → You have 2 dollars and 0 cents • 12 13 14 15 → You have 5 dollars and 92 cents

Submit your program electronicly using blackboard system

The program you submit should be your own work. Cheating will be reported to office of

academic integrity. Both the copier and copiee will be held responsible.