Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int baza(int n, int b)
- {
- int x = 0, p = 1, r;
- while(n)
- {
- r=n%b;
- x= x + r*p;
- p*=10;
- n/=b;
- }
- return x;
- }
- int cmax(int n)
- {
- int maxim = 0;
- while(n)
- {
- if(n%10>maxim)
- {
- maxim = n%10;
- }
- n/=10;
- }
- return maxim;
- }
- int main()
- {
- int n, k;
- cin >> n >> k;
- cout << cmax(baza(n, k));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement