High School Mathematics Extensions/Mathematical Programming/Program to Explore Integer Division And Integer Modulus

From Wikibooks, open books for an open world
< High School Mathematics Extensions‎ | Mathematical Programming
Jump to: navigation, search

Explanation[edit]

The first sample program was developed in three steps: Code for receiving commands. Code for giving output. An example of how to add an additional command and output.

This program will be developed in two steps. The first step will establish the commands we want to handle, and the second step will execute these commands. When we develop longer programs we may iterate through the input and output development process several times. The input process always has to come first, although may be implicit. If a program just does one thing than the command that caused the program to run is the input.

When we run the program below we are telling it to ask us what we want. It does this by displaying these choices:


Key Action
/ Display r/l.
 % Display r%l.
= Display r=value l=value.
r Set the value for r.
l Set the value for l.
x End program.


We will review how to output these choices, and will then look at the code for displaying the results.

Next Steps[edit]