Write a program in Python to print the numbers from 100 to 300 which are
divisible by both 5 and 7.
1
Add File
5 points
Write a program in Python to erade the students according to the following
Answers
Answered by
0
Answer:
lower = int(input("Enter lower range limit:"))
upper = int(input("Enter upper range limit:"))
for i in range(lower, upper+1):
if((i%3==0) & (i%5==0)):
print(i)
Answered by
5
Source code:
for i in range(100, 300):
if i%5 == 0 and i%7 == 0:
print(i)
Output:
105
140
175
210
245
280
This is has been done using a for loop, which is an iteration statement. It has a variable that changes its value each time it loops.
In this case, the starting value given was 100 and the ending value given was 300, and the changing variable 'i', takes the values of all the numbers between them.
If it satisfies the if-else clause, it gets printed, if not, it continues till it reaches the limit, which is 300.
Similar questions