Python program to determine if a given number is odd or even

What are odd and even numbers?

Those numbers which are divisble by two are called even numbers and other numbers are called odd numbers (i.e. they are not divisible by two).


Algorithm:-

Step 1- Start
Step 2- Input the number
Step 3- if n%2==0 then number is even
             else number is odd
Step 4- display the output
Step 5- Stop


Flowchart:-



Code:-

number=int(input("Enter a number:"))
if number%2==0:
    print("Even number")
else:
    print("odd number")

Note:-"%" is used to get reminder i.e. 5%2 will give 1 as the output. It is known as modulus operator.

Comments

Popular posts from this blog

Python program to determine if a given number is prime number

Python program to print factorial of a given number