We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 39c0b89 + 0264a9e commit e8b0423Copy full SHA for e8b0423
number_systems/convert_n_to_base_M/convert_n_to_base_M.cpp
@@ -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