Advertisement
Guest User

Program1

a guest
Apr 14th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.09 KB | None | 0 0
  1. @echo off
  2. echo Michael Harrison - %time% %date%>>results.txt
  3.  
  4. :whileLoop
  5.  
  6. set /p numberOne="Enter an Integer (999 to exit): "
  7. :: Check to make sure we got a number and not string input
  8. set /a numberOneVal="%numberOne%"*1
  9. if %numberOneVal% EQU 0 (
  10.     echo Not a Number!
  11.     goto whileLoop
  12. )
  13. :: Check to see if we have 999 exit
  14. if %numberOne% EQU 999 (
  15.     goto getMeOutOfHere
  16. )
  17. set /p numberTwo="Enter a 2nd non-zero Integer (999 to exit): "
  18. :: Check to make sure we got a real positive integer
  19. if %numberTwo% EQU 0 (
  20.     echo You have entered a zero!
  21.     goto whileLoop
  22. )
  23. :: Check to make sure we got a number and not string input
  24. set /a numberTwoVal="%numberTwo%"*1
  25. if %numberTwoVal% EQU 0 (
  26.     echo Not a Number!
  27.     goto whileLoop
  28. )
  29. :: Check to see if we have 999 exit
  30. if %numberTwo% EQU 999 (
  31.     goto getMeOutOfHere
  32. )
  33.  
  34. set /a moduloVal="%numberOne%" %% "%numberTwo%"
  35.  
  36. echo Number One: %numberOne%  Number Two: %numberTwo%  Modulus: %moduloVal%
  37. (echo %numberOne% %% %numberTwo% = %moduloVal%)>>results.txt
  38. goto whileLoop
  39.  
  40. :getMeOutOfHere
  41. echo Exiting Program
  42. pause
  43. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement