javascript check if a number is even or odd
const isEven = num => num % 2 === 0;
console.log(isEven(2));
// Result: True
javascript check if a number is even or odd
const isEven = num => num % 2 === 0;
console.log(isEven(2));
// Result: True
check whether number is even or odd
#check wheather a is odd or even
'''interactive mode
>>> 10%2
0....................False #(False==0)
>>> 5%2
1....................True #(True==1)'''
#scriptive mode
a=int(input('enter:'))
if a%2:
print("its odd")#solution gives true if 'a' value is even
else:
print("its even")#solution gives false if 'a' value is odd
print('hope it helped')
#output
#False
enter:100
its even
hope it helped
#even
enter:101
its odd
hope it helped
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us