Python Program to Find Even or Odd

    Even numbers are numbers that are evenly divided into two groups, such as 2, 4, 6, 8, 10.

    Odd numbers are numbers that are not evenly divided into two groups, such as 1, 3, 5, 7, 9.

    Program Code

    num = int(input("Enter a number: "))
    if (num % 2) == 0:
       print("{0} is Even".format(num))
       print("{0} is Odd".format(num))

    Input Given:

    Enter a number: 69

    Expected Output:

    69 is Odd

    Code Explanation

    1. We are taking input from the user and typecasting it into an integer.
    2. We are using the modulus operator to check if the number is even or odd.
    3. If the number is divisible by 2, it is even.
    4. If the number is not divisible by 2, it is odd.
    5. We are printing the result.
    Disclaimer: While we make every effort to update the information, products, and services on our website and related platforms/websites, inadvertent inaccuracies, typographical errors, or delays in updating the information may occur. The material provided on this site and associated web pages is for reference and general information purposes only. In case of any inconsistencies between the information provided on this site and the respective product/service document, the details mentioned in the product/service document shall prevail. Subscribers and users are advised to seek professional advice before acting on the information contained herein. It is recommended that users make an informed decision regarding any product or service after reviewing the relevant product/service document and applicable terms and conditions. If any inconsistencies are observed, please reach out to us.

    Latest Articles

    Related Stories

    Leave A Reply

    Please enter your comment!
    Please enter your name here

    Join our newsletter and stay updated!