1) Check whether a number is even or odd :
PROGRAM :
n = 6
if n%2==0:
print("even")
else:
print("odd")
HERE, i have write a code to find wheather the number is 'odd' or 'even.
so, that i have create a variable which is 'n' for the particular variable i have assigned a value which is '6'.
OUTPUT :
WAY2 :
PROGRAM 2 :
n = 7
if n &1:
print("odd")
else: print("even")
OUTPUT :
Top comments (0)