Sie sind auf Seite 1von 1

WORKSHEET 1: Input, Output, Variables and Arithmetic in C

1. Write a program in C that takes any integer value as input and outputs the remainder of that number
when it is divided by 2. In other words, write a program to compute n mod 2, where n is any integer
value.

2. Consider the following denominations of the US dollar: 25 cents (quarter), 10 cents (dime), 5 cents
(nickel) and 1 cent (cent/penny). Write a program that computes the change for any given input
value.

For example: Given $2.27, your program should output 8 quarters, 2 dimes, 1 nickel and 3 cents.

Note:
1. Remember to give meaningful names to any variables used.
2. Use indentation to make your code more readable.
3. Use comments where necessary to keep track of the logics of your program.
4. Your program should be user-friendly (user prompts and proper display of output)

Das könnte Ihnen auch gefallen