Computer Science, asked by shahissain, 1 year ago

write a python coding to accept and print it is odd or even number​

Answers

Answered by LuckyYadav2578
9

n = int (input (" enter any number " ))

if ( n%2 == 0 ):

______ print ( " it is a even number " )

else :

______ print ( " it is a odd number "))

Another way

n = int (input (" enter any number " ))

a = n%2

if a== 0:

______ print ( " it is a even number " )

else :

______ print ( " it is a odd number "))

note : you can also use not (!) for this code

All the even numbers are divisible by 2 and their remainder will be 0 that why using this (n%2 == 0) statement

Answered by AskewTronics
0

Below are the python program and the output for the above question:

Output:

If the user input as 4, then "The entered number is even number" is printed.

If the user input as 3, then "The entered number is odd number" is printed.

Explanation:

number=int(input("Enter the number: "))#Take the number from the user.

if number%2==0:#if-else condition to check the number for even or odd.

   print("The entered number is even number")#Print the even number.

else:

   print("The entered number is odd number")#Print the odd number.

Code Explanation :

  • The above code is in python language, in which the first line is used to instruct the user and take the input from the user.
  • Then the if-else condition is used to check that the number is even or odd and render the appropriate message.

Learn More :

  • Python : https://brainly.in/question/14689905

Similar questions