Python program to find those numbers which are divisible by 7 and multiple of 5, between 1500 and 2700

Example 1:-

nl=[]
for x in range(500, 1350):
    if (x%7==0) and (x%5==0):
        nl.append(str(x))
print (','.join(nl))

output:-

525,560,595,630,665,700,735,770,805,840,875,910,945,980,1015,1050,1085,1120,1155,1190,1225,1260,1295,1330

>>> 

Example 2:-

for i in range(1500,2701):

    if i%7==0 and i%5==0:

        print(i)
output:-

1505

1540

1575

1610

1645

1680

1715

1750

1785

1820

1855

1890

1925

1960

1995

2030

2065

2100

2135

2170

2205

2240

2275

2310

2345

2380

2415

2450

2485

2520

2555

2590

2625Enter the lower range:10

Enter the upper range:1000

35

70

105

140

175

210

245

280

315

350

385

420

455

490

525

560

595

630

665

700

735

770

805

840

875

910

945

980

>>> 

2660

2695

>>> 

Example 3:-

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)
output:-


Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post