The Number System
##### Submissions: 1079   Accuracy: 39.01%   Difficulty: Basic   Marks: 1

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.

Input :
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.

Output :
For each test case, print the required answer in a new line.

Constraints :
1 <= T <= 200
1 <= N <= 10^9
2 <= K <= 10

Example :
Input :

3
10 2
4 8
15 6
Output :
1010
4
23

Explanation :
Case 1 :

10 in Binary = 1010

Case 2 :
4 in Octal = 4

Case 3 :
15 in Base 6 = 23

#### ** For More Input/Output Examples Use 'Expected Output' option **

Author: goyalanubhav11

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.

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.