Answer to Question #234404 in Python for Aditi

Question #234404
Write a python program that first asks the user how many numbers should be entered. Then the program will read that many numbers from the user, and print the numbers which are multiples of 5 or 7. For example, if user input is 5, your program should read 5 numbers and check if they are multiples of 5 or 7. You must use loops to solve this task.
Sample Input:
No. of Inputs = 5
1
Expert's answer
2021-09-07T23:21:41-0400
N=int(input("How many numbers should be entered: "))
numbers=[]
for i in range(N):
    n=int(input())
    numbers.append(n)
count=0
for x in numbers:
    if x%5==0 or x%7==0:
        count=count+1


print("No. of inputs: ", count)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS