T3RRYT3RR0R

Batch 'Challenge'

Jan 7th, 2020
430
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.77 KB | None | 0 0
  1. @echo off
  2.  
  3. REM :: The (Not so) "Impossible" Challenge.
  4.  
  5. REM :: OBJECTIVE - Test input of a number from keyboard and display a message of zero for number 0 and 1 for all other numbers
  6.  
  7. REM - Originally asked for Pascal / Delphi program language. https://chat.stackoverflow.com/rooms/882/programmers
  8.  
  9. REM :: RULES - Don't use any conditions (if..then, while, case, etc.), don't use any operators and don't use any functions with conditions.
  10.  
  11. REM - Batch Equivelant restrictions: Cannot use 'If', 'Else', 'x==y', 'x neq y', cannot use = + - / % * as operators.
  12.  
  13. :start
  14. cls
  15. CALL :loop
  16. ECHO(%errorlevel%
  17. pause
  18. GOTO start
  19.  
  20. :loop
  21. CHOICE /N /C:0123456789 /m "Enter a Number."
  22. FOR /L %%a in (%errorlevel%,1,1) DO (
  23.     exit /b 0
  24. )
  25.  
  26. exit /b 1
  27.  
  28. Can you find another solution?
Advertisement
Add Comment
Please, Sign In to add comment