Checked and commented program 3