Multiple of 5 in Python

Problem Statement:

Here, we need to take an integer as input. Then, we need to take n integers as input in the next n lines. After all this, we need to print the n integers one by one until we encounter the first number which is a multiple of 5.

For example
Input
Enter the value of n: 6
Enter new 6 integers:
12
23
34
45
56
67
Output
Multiple of 5 detected after these integers=> 12 23 34

Code to find multiple of 5 in Python:

n = int(input('Enter the value of n: '))
print('Enter new ', n, ' integers: ')
free_list = []
for i in range(n):
    free_list.append(int(input()))
print('Multiple of 5 detected after these integers=>', end=' ')
for i in free_list:
    if i%5 ==0:
        break
    print(i, end=' ')

Output:

Output to find Multiple of 5 in Python

Also Read:

Share:

Author: Harry

Hello friends, thanks for visiting my website. I am a Python programmer. I, with some other members, write blogs on this website based on Python and Programming. We are still in the growing phase that's why the website design is not so good and there are many other things that need to be corrected in this website but I hope all these things will happen someday. But, till then we will not stop ourselves from uploading more amazing articles. If you want to join us or have any queries, you can mail me at admin@copyassignment.com Thank you