Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- main()
- {
- int n, b, i=0, a[10];
- cin >> n >> b;
- // (10)21 (2)10101 (8)25
- while (n>0)
- {
- a[i] = n % b;
- n = n / b;
- i = i + 1;
- }
- for (int j = i - 1; j>=0; j--)
- cout << a[j];
- cout << endl;
- system ("PAUSE");
- }
Advertisement
Add Comment
Please, Sign In to add comment