Homework program2 by Ivailo Ivanov