Skip to content

Commit e8b0423

Browse files
authored
Merge pull request #594 from MohamedWagih/mwagih
Mwagih
2 parents 39c0b89 + 0264a9e commit e8b0423

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include<iostream>
2+
#include<string>
3+
using namespace std;
4+
5+
//convert till Base 36
6+
string arr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
7+
8+
string covert(int N, int B){
9+
if (N < B)
10+
return string(1,arr[N]);
11+
else
12+
return (covert((int)(N / B), B) + string(1, arr[N%B]));
13+
}
14+
15+
int main(){
16+
int n, b;
17+
cin >> n >> b;
18+
cout << covert(n, b);
19+
return 0;
20+
}

0 commit comments

Comments
 (0)