Computer Science, asked by dhruvgarg2, 1 year ago

What would be the python code for the task - user input a number to identify if its odd or even

Answers

Answered by siddhartharao77
0
a = int(input('Enter any number: '))

if a % 2 == 0:   

print("Even Number") 

  else:   

 print("Odd Number")
Answered by fiercespartan
0

We can know if a number is even or odd if the remainder of the number divided by 2 is 0 or something else.

So, to write the program, we will look for the remainder of the number provided.

def even_odd(num):

   return 'Even' if num%2 == 0 else 'Odd'

even_odd(int(input('Enter your number:')))

Similar questions