Introduction

     In this blog post, we'll explore a simple Python program that checks whether a given number is odd or even. Understanding the logic behind odd and even numbers is fundamental in programming, and this example serves as a basic illustration.  


Code

    
     
        # Check the given number is Odd or Even
        number = int(input("Enter a number: "))
        
        if (number % 2) == 0:
            print(number, "is an even number")
        else:
            print(number, "is an odd number")
       
     


Output


    Enter a number: 4
    4 is an even number
       


    
    In this case, the program correctly identifies that the number 4 is even and displays the corresponding message. You can try running the program with different input numbers to observe how it determines whether a number is odd or even.

Explanation

1. User Input:
    The program prompts the user to enter a number.
2.Checking Odd or Even:
    It uses the modulus operator % to check if the number is divisible by 2. If the remainder is 0, the     number is even; otherwise, it's odd.
3.Output:
Displays whether the entered number is even or odd.

Conclusion

     This Python program provides a quick way to determine whether a given number is odd or even. Understanding the concepts of modulus and conditional statements is crucial for beginners in programming. Feel free to experiment with different input numbers and observe how the program accurately identifies their odd or even nature. Happy coding!