Python Program to Find Numbers which are Divisible by 7 and Multiple of 5 in a Given Range

This is a Python Program to find those numbers which are divisible by 7 and multiple of 5 in a given range of numbers.

Problem Description

The program takes an upper range and lower range and finds those numbers within the range which are divisible by 7 and multiple of 5.

Problem Solution

1. Take in the upper and lower range and store it in separate variables.
2. Use a for loop which ranges from the lower range to the upper range.
3. Then find the numbers which are divisible by both 5 and 7.
4. Print those numbers
5. Exit.

Program/Source Code

Here is source code of the Python Program to find those numbers which are divisible by 7 and multiple of 5 in a given range of numbers. The program output is also shown below.

 
lower=int(input("Enter the lower range:"))
upper=int(input("Enter the upper range:"))
for i in range (lower,upper+1):
    if(i%7==0 and i%5==0):
        print(i)
Program Explanation

1. User must enter the upper range limit and the lower range limit.
2. Then the for loop ranges from the lower limit to the upper limit.
3. The value of i ranges from the lower limit to the upper limit.
4. Whenever the remainder of i divided by 5 and 7 is equal to 0, i is printed.

advertisement
advertisement
Runtime Test Cases
 
Case 1:
Enter the lower range:1
Enter the upper range:100
35
70
 
Case 2:
Enter the lower range:400
Enter the upper range:700
420
455
490
525
560
595
630
665
700

Sanfoundry Global Education & Learning Series – Python Programs.

To practice all Python programs, here is complete set of 150+ Python Problems and Solutions.

Note: Join free Sanfoundry classes at Telegram or Youtube

If you find any mistake above, kindly email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.