This post was most recently updated on July 31st, 2024
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# This Program is to check whether number entered is ODD or Even inputNumber = int(input("Enter the number \n")) # If number is divisible by 2 then it is Even else ODD # Use if condition if (inputNumber % 2) > 0: print (inputNumber , "is ODD number") else: print (inputNumber , "is Even Number") # Print number of even number noEvenNumber = int(input("How many even number you want to print\n")) # for this we need to use while loop no = 1 while noEvenNumber >= 1: noEvenNumber = noEvenNumber - 1; print (no * 2); no = no + 1; |