Number in P number system (P<10)
Problem
Write a
recursive procedure that converts a number to any base from
2
to
9
.
Input
The input to the program is a natural number
N
(N <= 1024) - a number in
10
number system and a number
P
(2 <= P <=9). The numbers
N
and
P
are entered on the same line separated by a space.
Imprint
Print one number on the screen - a number in
P-ary number system.
Examples
# |
Input |
Output |
1 |
75 6 |
203 |
Запрещенные операторы: for;while;until