0
Write all the number of which is divided by 7 and multiply by 5from 1500 to 2700
By using while loop
6 Antworten
+ 1
A way of finding multiples is by testing if the division outputs 0 as remainder. Thus, you can do something like this:
i = 1500
while i <= 2700:
if i % 7 == 0 and i % 5 == 0:
print(i)
i+=1
I advise you to use a for loop instead of a while loop:
for i in range(1500, 2701):
...
Happy coding!
+ 3
Amazing Akash Gupta This program seems easy. Have you ever tried to do self?
0
Do you mean all numbers that are multiple of 7 and 5, or all numbers that are multiple of 7, and just multiply them by 5 before being printed?
0
Yes divided by 7 and 5
0
Thank you for this but your first one program is not working
0
Yes that one is working