Decimal to any base conversion
Submissions: 1117   Accuracy:

37.69%

  Difficulty: School   Marks: 0
*School Problem's Submission isn't counted in score!

Given a decimal number and the base to which it should be converted. Convert the given number to the given base.

Input:
The first line of input contains an integer T denoting the number of test cases. For each test case there will be two lines. The first line contains the base, second line contains the number N, where N is the decimal number.

Output:
Decimal number converted to the given base is displayed to the user.

Constraints:
1 <= T <= 5
2 <= base <= 16
1 <= N <= 999999999

Example:
Input:

3
2
12
16
282
8
83

Output:
1100
11A
123

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

Author: atharv


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.