How to make this add every number a 0 in the loop

0 votes

How to make this add every number %a == 0 in the loop:
b = int(input())

for i in range(0,101):
    if i % b == 0 :
        print(i)

I need to sum up the numbers that can be divided by the integer of b, if i type in the number 30, then i want to sum up 30 + 60 + 90

How do I do this?

Nov 4, 2020 in Python by anonymous
• 8,870 points
404 views

1 answer to this question.

0 votes

You can go through the given below code:

b = int(input())
s=0
for i in range(0,101):
    if i % b == 0 :
        s+=i
print(s)
answered Nov 4, 2020 by Gitika
• 65,770 points

Related Questions In Python

0 votes
1 answer

How to add to the python path in Windows?

You know what has worked for me ...READ MORE

answered Jul 25, 2018 in Python by Frankie
• 9,830 points
1,021 views
0 votes
1 answer

How to count the number of elements in a list?

To count the number of elements of ...READ MORE

answered May 27, 2019 in Python by Nisa
• 1,090 points
5,237 views
0 votes
1 answer

How to find the greatest number in a list in Python?

1. By using max function -  highest = ...READ MORE

answered Aug 21, 2019 in Python by Neel
• 3,020 points
2,864 views
0 votes
1 answer
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,422 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
4,042 views
0 votes
1 answer

I want to download a file from the website by web scraping. Can anyone explain how to do this in jupyter lab (python) with an example?

Hey, Web scraping is a technique to automatically ...READ MORE

answered Apr 7, 2020 in Python by Gitika
• 65,770 points
2,378 views
0 votes
1 answer

How to create a unicode string in python with the string eg: This is a string?

Hey, @Roshni, It is very simple to execute, ...READ MORE

answered Jun 23, 2020 in Python by Gitika
• 65,770 points
791 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP