#include int main() { char base_digits[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; int converted_number[32]; int n, b, index = 0; scanf("%d %i", &n, &b); while (n != 0) { converted_number[index] = n % b; n /= b; ++index; } --index; for (; index >= 0; index--){ printf("%c", base_digits[converted_number[index]]); } return 0; }