Homework program3 by IvailoIvanov