Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: konthaina_TH

Problemset: Base Converter

Language: cpp

Time: 0.003 second

Submitted On: 2026-03-06 10:44:43

#include <bits/stdc++.h>
using namespace std;


void convert(int n,int base) {
    if ( n == 0) return;
   convert(n/base,base);

   int remainder = n % base;
   if (remainder < 10) cout << remainder;
   else cout << (char)('A' + (remainder-10));
}
int main() {
    int n,base;
    cin >> n >> base;
    convert(n,base);
}