python program to check if a number is odd or even |


python program to check if a number is odd or even |

Python Program to Check if a Number is Odd or Even



If you divide a number by 2 and it gives a remainder of 0 then it is known as even number, otherwise an odd number.



python program to check if a number is odd or even |
python program to check if a number is odd or even 

programs -



num = int(input("Enter a number: "))  

if (num % 2) == 0:  

   print("Even number",num)  

else:  

   print("Odd number",num) 





output -




case 1

Enter a number: 22
Even number

case 2

Enter a number: 9
Odd number 9













Post a Comment

Post a Comment (0)

Previous Post Next Post