Here’s a program flow listing and a rough program flow diagram for dealing with inputs.

Here is a program flow listing:

programFlow.drawio.svg