printnum now checks if stack is empty and exit calls are added