-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNBASE
More file actions
31 lines (31 loc) · 677 Bytes
/
NBASE
File metadata and controls
31 lines (31 loc) · 677 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.lang.*;
import java.util.*;
class HelloWorld {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int num=sc.nextInt();
String res="";
List<Integer>li=new ArrayList<>();
int r=0;
while(num!=0)
{
r=num%n;
li.add(r);
num=num/n;
}
// System.out.println(li);
for(int i=0;i<li.size();i++)
{
if(li.get(i)>9)
{
res=(char)(li.get(i)-9+64)+res;
}
else
{
res=li.get(i)+res;
}
}
System.out.println(res);
}
}