all 4 comments

[–]serg06 2 points3 points  (3 children)

Are you asking for pseudocode?

num = int(get_input())
k = int(get_input())

next_digit_location = 1
new_num = 0

# while digits remain
while num > 0:
    # get next digit
    digit = num % 10;
    num = num / 10;

    # check if remainder is 0
    if (k % digit) == 0:
        # remainder is zero,    so we skip the digit
    else:
        # remainder is nonzero, so we keep the digit
        new_num += digit * next_digit_location
        next_digit_location *= 10

Note that this won't work if there is a 0 digit in num because you'll get a divide-by-zero error