Input 10 number check all are even or not using for loop in Python
for Loop - Question 7
In this question, we will see how to input 10 numbers and check whether all the entered numbers are even numbers only or not in Python programming using for loop. To know more about for loop click on the for loop lesson.
Q7) Write a program in Python to input 10 numbers and check whether all the entered numbers are even numbers only or not using for loop.
ec=0 print('Enter 10 numbers') for i in range(1,11): n=int(input()) if n%2==0: ec=ec+1 # counting the even numbers if ec==10: print('All numbers are even') else: print('All numbers are not even')
Enter 10 numbers 2 8 6 12 18 36 24 4 48 90 All numbers are even