Computer Science, asked by abhranilDutta, 5 hours ago

Write a program in python to find and display the count of all those numbers which are between 1 and N, which are either divisible by 3 or by 7.

For example :

If the value of N is 15

The sum should be displayed as

7

(as 3,6,7,9,12,14,15 in between 1 to 15 are either divisible by 3 or 7)​

Answers

Answered by shubhkuhh08
0
nl=[]
for x in range(1500, 2701):
if (x%7==0) and (x%5==0):
nl.append(str(x))
print (','.join(nl))

Output

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,2625,2660,2695
Similar questions