42 lines
1.3 KiB
Text
42 lines
1.3 KiB
Text
To run:
|
|
Start up.
|
|
Set up the console.
|
|
Write "Type the first number: " to Stdout.
|
|
Read a buffer from stdin.
|
|
Trim the buffer.
|
|
If the buffer is not any integer,
|
|
Write "Invalid input. Aborting Operation."
|
|
then the CRLF string to StdOut;
|
|
Shut down;
|
|
Exit.
|
|
Write "Type the second number: " to Stdout.
|
|
Read a second buffer from stdin.
|
|
Trim the second buffer.
|
|
If the second buffer is not any integer,
|
|
Write "Invalid input. Aborting Operation."
|
|
then the CRLF string to StdOut;
|
|
Shut down;
|
|
Exit.
|
|
Convert the buffer to a number.
|
|
Convert the second buffer to a second number.
|
|
Output the sum of the number and the second number.
|
|
Shut down.
|
|
|
|
To output the sum of a number and another number:
|
|
If the number is not valid,
|
|
Write "Invalid input. Aborting Operation."
|
|
then the CRLF string to StdOut;
|
|
Exit.
|
|
If the other number is not valid,
|
|
Write "Invalid input. Aborting Operation."
|
|
then the CRLF string to StdOut;
|
|
Exit.
|
|
Add the other number to the number.
|
|
Convert the number to a string called result.
|
|
Write "The sum is " then the result
|
|
then the CRLF string to StdOut.
|
|
|
|
To decide if a number is valid:
|
|
If the number is less than -1000, say no.
|
|
If the number is greater than 1000, say no.
|
|
Say yes.
|