SimeonTs

SUPyF2 Basic Exercise - 07. Maximum Multiple

Sep 24th, 2019
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.76 KB | None | 0 0
  1. """
  2. Basic Syntax, Conditional Statements and Loops - Exercise
  3. Check your code: https://judge.softuni.bg/Contests/Compete/Index/1719#6
  4. Video: https://www.youtube.com/watch?time_continue=4&v=7sHE4HEUqi8
  5.  
  6. SUPyF2 Basic Exercise - 07. Maximum Multiple
  7.  
  8. Problem:
  9. Given a Divisor and a Bound, find the largest integer N, such that:
  10. N is divisible by divisor
  11. N is less than or equal to bound
  12. N is greater than 0.
  13.  
  14. Notes: The divisor and bound are only positive values. It's guaranteed that a divisor is found
  15.  
  16. Examples:
  17. Input:  Output:
  18. 2
  19. 7       6
  20.  
  21. 10
  22. 50      50
  23.  
  24. 37
  25. 200     185
  26. """
  27.  
  28. divisor = int(input())
  29. bound = int(input())
  30. number = bound
  31.  
  32. while True:
  33.     if number % divisor == 0:
  34.         print(number)
  35.         break
  36.     else:
  37.         number -= 1
Add Comment
Please, Sign In to add comment