Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- REM :: The (Not so) "Impossible" Challenge.
- REM :: OBJECTIVE - Test input of a number from keyboard and display a message of zero for number 0 and 1 for all other numbers
- REM - Originally asked for Pascal / Delphi program language. https://chat.stackoverflow.com/rooms/882/programmers
- 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.
- REM - Batch Equivelant restrictions: Cannot use 'If', 'Else', 'x==y', 'x neq y', cannot use = + - / % * as operators.
- :start
- cls
- CALL :loop
- ECHO(%errorlevel%
- pause
- GOTO start
- :loop
- CHOICE /N /C:0123456789 /m "Enter a Number."
- FOR /L %%a in (%errorlevel%,1,1) DO (
- exit /b 0
- )
- exit /b 1
- Can you find another solution?
Advertisement
Add Comment
Please, Sign In to add comment