1
votes

I take two numbers from the user and I have to print the numbers between them, which can be divided into 5,000, how to do this in python?

For example, a=12005 and b=28077

the result should be: 15000 20000 25000

I don't have an idea can you help me with it, please?

2
Please add the code you have written until nowAnshumaan Mishra
What have you tried? What stops you from doing this? What is your programming question about this problem? Simply asking for code from others is not the purpose of Stack Overflow. You are expected to ask an actual questionTomerikoo
It would probably help you to try and break down the problem to steps: i.e. 1) Do you know how to take numbers from the user? (How can I read inputs as numbers?). 2) Do you know how to get a range between two numbers? 3) Do you know how to check if a number is divisible by another? (How do you check whether a number is divisible by another number?)Tomerikoo

2 Answers

0
votes
firstNo = int(input())
secondNo = int(input())
for i in range(firstNo, secondNo):
    if i%5000 == 0:
        print(i, end=“”)
0
votes

You can iterate all numbers with

a = 12005
b = 28077
step = 5000
num = step * (a // step) + step
while num < b:
    print(num)
    num += step