Coding | Mcqs | Multiple choice questions | Informative | Computer Science | Engineering | Aptitude | Quants | Verbal

INFEED

Daily challenge [06/04/2021]

 Extended Divisibility

sample input:

4 2

o/p:

4 2 2 1 1 1 1

Program in Python:

a,b=map(int,input().split())

x=a

z=b

k=[a]

while(x%b==0):

    for j in range(z):

            k.append(x//b)

        z*=b

        x=x//b

print(*k,sep=" ")

Post a Comment

Previous Post Next Post