Search This Blog

Saturday, 20 November 2021

Write a Python program to find whether a given number (accept from the user) is even or odd, print out an appropriate message to the user

Introduction
Here we are writing a program to find whether a given number is even or odd.

PROGRAM
----------------------------------------------
num = int(input("Enter a number: "))
mod = num % 2
if mod > 0:
    print("This is an odd number.")
else:
    print("This is an even number.")
----------------------------------------------
RESULTS : 

Enter a number: 5                                                                                             
This is an odd number.

No comments:

Post a Comment

Sentiment Analyzer using NLP and Python - Practical Guide How to - Ai dev Surya

Unlocking Insights: NLP Project for Sentiment Analysis Natural Language Processing (NLP) is revolutionizing how computers understan...