+ 4

Code challenge

check the given number is even or odd without using %, *, / operator....

6th Mar 2018, 4:06 AM
vasu
vasu - avatar
7 Antworten
+ 17
submit it as an assignment in lesson factory
6th Mar 2018, 5:13 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 13
Please submit this as an assignment in the Lesson Factory https://www.sololearn.com/discuss/1082512/?ref=app
6th Mar 2018, 5:17 AM
Learnsolo
+ 11
print("Odd" if int(input())&1 else "Even") print(["Even", "Odd"][int(input())&1])
9th Mar 2018, 12:14 PM
Kartikey Sahu
Kartikey Sahu - avatar
+ 4
ok
6th Mar 2018, 5:46 AM
vasu
vasu - avatar
+ 4
check in code playground ...already submitted
6th Mar 2018, 5:50 AM
vasu
vasu - avatar
+ 4
if (num % 2 == 0) cout << "Even"; else cout << "Odd"; //Or cout << (num % 2 == 0) ? "Even" : "Odd"; //Or cout << (!(num%2)) ? "Even" : "Odd"; //Or cout << (num%2) ? "Odd" : "Even";
6th Mar 2018, 6:41 AM
Naveen Maurya
Naveen Maurya - avatar