+ 3
Challenge:Input any number and find whether the number is even or odd without using any logical and relational operators..
6 Answers
+ 8
đtake the number as String , and take out last character & use .equals("0")||.equals ("2")||.equlas ("4") ....equals ("8")
//well here I used some restricted operators
đmake use of modulo(%)
đrun a loop & substact 2 repeatedly if num >0 , now compare num+"" with "1" using .equals method ... if true then odd else even
//thinking ....
+ 2
#include <stdio.h>
Â
int main()
{
    int number;
    Â
    //input an integer number
    printf("Please input an integer number: ");
    scanf("%d",&number);
        Â
    //check 0th bit of number is 1 or 0
    (number & 0x01) ? printf("%d is an EVEN Number.â, number) : printf("%d is an ODD Number.",number) ;
    Â
    printf("\n";)
    return 0; Â
}
+ 2
n=str(input())
if n[-1] in list(range(0,10,2)):
print('even')
else:
print('odd')
+ 1
https://code.sololearn.com/c07vjWirgFUo/?ref=app Can you check it?