Write a C/C++ program that accepts a number from the user and prints “Even” if the entered number is even and prints “Odd” if the number is odd. You are not allowed to use any comparison (==, <, >, …etc) or conditional (if, else, switch, ternary operator,..etc) statement.
Below is a tricky code can be used to print “Even” or “Odd” accordingly.
Below is another tricky code can be used to print “Even” or “Odd” accordingly. Thanks to student for suggesting this method.
Please write comments if you find the above code incorrect, or find better ways to solve the same problem
- C Program to print numbers from 1 to N without using semicolon?
- How to write a running C code without main()?
- Bitwise Operators in C/C++
- How to find length of a string without string.h and loop in C?
- To find sum of two numbers without using any operator
- Program to compute Log n
- Can we call an undeclared function in C++?
- How will you show memory representation of C variables?
- What is the best way in C to convert a number to a string?
- Condition To Print "HelloWord"
- Implement Your Own sizeof
- Write a one line C function to round floating point numbers
- Write a C program to print "Geeks for Geeks" without using a semicolon
- Program for Sum the digits of a given number
- How will you print numbers from 1 to 100 without using loop?
Improved By : Prateek Bajaj