Program 3.3 from Kochan