I think you are misunderstanding the requirements. You need to validate user input before you can perform the sum. So you will need 2 loops, one for each task.