Answer to Question #256250 in Python for rasi

Question #256250

5. Find the minimum positive integer such that it is divisible by A and the sum of its digits is equal to B - Link 



1
Expert's answer
2021-10-25T05:31:13-0400
# Note: solution exists not for all A anb B!!! Example: A=3, B=8
def find1(a, b):
    i = 1
    while True:
        if sum(map(int, list(str(i * a)))) == b:
            break
        i += 1
    return a * i

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS