Advertisement
Guest User

Question 1&2

a guest
Jan 19th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. down=int(input())    # the lower limit of range
  2. up=int(input())      # the upper limit of range
  3. number1=int(input())  # the first divisor
  4. number2=int(input())  # the second divisor
  5. count=0               # nr of solutions
  6. summ=0                # sum of the solutions
  7. for i in range(down,up+1):
  8.    if i%number1==0 and i%number2!=0:
  9.          count+=1
  10.          summ+=i
  11. print('Number of solutions=',count)
  12. print('Sum of solutions=',summ)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement