Change for to while in Problem023.cpp