Post Page Advertisement [Top]

python program

Write a program in python to check whether the given number is odd or even ?

Program to check whether the given number is odd or even.

As we know that An integer value that can divided exactly by 2 is an even number. so that if a number is divided 2 then that no is even, else odd.

Steps of programming:-

  1. Get input from user.
  2. check that number is divisible by 2 or not.
  3. if number is divisible by 2 then print even else print odd

code:


x=input("Enter A Number")

y=x%2

if y==0:

    print(x,"is an Even Number")

else:

    print(x"is a Odd Number")
#DizIT_Operators
Thank-you

No comments:

Post a Comment

Bottom Ad [Post Page]