[ Web Proxy ]
URL:
Viewing: https://www.programminginpython.com/even-odd-number-python/ [Back]  [Original]

Python Program to find whether an integer is even or odd number - Programming In Python
Skip to content
Home Python Program to find whether an integer is even or odd number

Python Program to find whether an integer is even or odd number

Python Program to find whether an integer is even or odd number [Python Program to find whether an integer is even or odd number] Python Program to find whether an integer is even or odd number

Hello everyone, welcome to Programming In Python. In this post, I will develop a simple logic to check whether an integer is an even or odd number in Python. Any number(positive/negative) which is divisible by the number 2 is declared as an even number and numbers( positive/negative ) which are not divisible by the number 2 are declared as odd numbers.

Program on GitHub

Even or Odd Code Visualization

Task :

To check whether an integer is an even number or an odd number.

Approach :

  • Read an input integer using input() or raw_input().
  • When the input is divided by 2 and leaves a remainder 0, it is said to be EVEN number.
  • When the input is divided by 2 and leaves any remainder other than 0, it is said to be ODD number.
  • When an input is 0 it is said to be even.
  • The same conditions apply to negative integers too.

Video Demonstration :

You can also watch the video on YouTube here.

Program on GitHub

Program :

input_num=int(input('Enteranynumber:'))

ifinput_num%2==0:
print(input_num,"isEVEN")
else:
print(input_num,"isODD")

Output :

Program on GitHub

Course Suggestion

Want to be strong at OOP in Python? If yes, I would suggest you to take the course below.
Course:
Object Oriented Programming in Python

Online Python Compiler

Tagged: basic else even if numbers odd python

Post navigation

Leave a Reply Cancel reply

author:
email:
url:
comment:
ak_hp_textarea:

Programming In Python 2026. Powered By BlazeThemes.

Web Proxy Viewer  |  New URL  |  Original Page