Write a Python program to find whether a given number is even or odd


Introduction

Write a Python program to find whether a given number is even or odd. I have used python 3.7 compiler for debugging purpose.


techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

  1. num = int(input("Enter a number: "))
  2. mod = num % 2
  3. if mod > 0:
  4. print("This is an odd number.")
  5. else:
  6. print("This is an even number.")
  7.  

Result

python language techstudy.org

     





Related Topics




Popular Posts