Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
##QBIC, 7 5 bytes
:?a%2
This prints 0 for even values, and 1 for odds.
0
1
Explanation:
: get a number from the cmd line args ? PRINT a%2 The input modulo 2 (1 for odds, 0 even)
##QBIC, 77 5 bytes
:?a%2=0a%2
This prints -1 (QBasic's idea of true0 for even values, and 01 for odds.
-1
true0
01
: get a number from the cmd line args ? PRINT a%2 The input modulo 2 (1 for odds, 0 even) =0 compared to 0. This yields -1 or 0
##QBIC, 7 bytes
:?a%2=0
This prints -1 (QBasic's idea of true for even values, and 0 for odds.
true