PROGRAM DECIMAL

IMPLICIT NONE

INTEGER  :: I,X,B,D,Y

READ *, X,B

I=-1
Y=X

DO WHILE(1)

IF (I.NE.-1) Y=(Y-D)/B

IF (Y.LT.B) THEN 
D=Y
PRINT *,D
STOP 'NUMBER CONVERTED'
ELSE
D= MOD(Y,B)
I=I+1
PRINT *,D
ENDIF

ENDDO

END PROGRAM DECIMAL

