Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- echo Michael Harrison - %time% %date%>>results.txt
- :whileLoop
- set /p numberOne="Enter an Integer (999 to exit): "
- if not defined numberOne set "numberOne=noEntry"
- :: Check to make sure we got a number and not string input
- set /a numberOneVal="%numberOne%"*1
- if %numberOneVal% EQU 0 (
- echo Not a Number!
- goto whileLoop
- )
- :: Check to see if we have 999 exit
- if %numberOne% EQU 999 (
- goto getMeOutOfHere
- )
- set /p numberTwo="Enter a 2nd Non-zero Integer (999 to exit): "
- if not defined numberTwo set "numberTwo=noEntry"
- :: Check to make sure we got a real positive integer
- if %numberTwo% EQU 0 (
- echo Not a valid number!
- goto whileLoop
- )
- :: Check to make sure we got a number and not string input
- set /a numberTwoVal="%numberTwo%"*1
- if %numberTwoVal% EQU 0 (
- echo Not a Number!
- goto whileLoop
- )
- :: Check to see if we have 999 exit
- if %numberTwo% EQU 999 (
- goto getMeOutOfHere
- )
- set /a moduloVal="%numberOne%" %% "%numberTwo%"
- echo Number One: %numberOne% Number Two: %numberTwo% Modulus: %moduloVal%
- pause
- echo %numberOne% %% %numberTwo% = %moduloVal%>>results.txt
- set "numberOne="
- set "numberTwo="
- goto whileLoop
- :getMeOutOfHere
- pause
- exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement