Ishaan has been learning different representations of numbers, like binary, octal, decimal, etc. He has an assignment of a lot of problems. He is given 2 integers N and K.
Ishaan needs to convert N (given in decimal) and convert it to base K. Help him calculate the answer.
First line of input contains a single integer T denoting the number of test cases.
The only line of each test case contains 2 space-separated integers N and K.
For each test case, print the required answer in a new line.
1 <= T <= 200
1 <= N <= 10^9
2 <= K <= 10
Case 1 :
10 in Binary = 1010
Case 2 :
4 in Octal = 4
Case 3 :
15 in Base 6 = 23
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.