
ELEC 2220 - Homework Assignment #1
Prerequisite Review
Due Wednesday, August 20, 2008
1. Write a short program in either C or Java that will read non-zero integer numbers
entered from a keyboard until a zero is entered, and then identify and print the
smallest number, the largest number, and the average value (don’t count the 0 in the
average). Assume numbers in the range [-32000 … +32000]. Execute the program,
entering 12-15 values, scattered across the above range (both positive and negative
values). Turn in a printout of the program and the results
Example:
30
-25
18
-3
0
Smallest = -25
Largest = 30
Average = 5
2. Four light-emitting diodes (LEDs) are designated as LED0, LED1, LED2, and
LED3. These LEDs are illuminated by applying a voltage to them corresponding
to "logic 1", and darkened by applying a voltage to them corresponding to logic 0.
A computer generates a 4-bit number A = a3a2a1a0. Design and sketch a digital
logic circuit that will illuminate LED0 when A=1100, LED1 when A=1101,
LED2 when A=1110, and LED3 when A=1111. For all other values of A, the
LEDs should be dark. You may use logic gates and/or decoder modules for your
circuit. Clearly label all LEDs and signal lines.