### Decimal to N-Base Conversion

Problem Statement

N-base notation is a system for writing numbers that uses only [tex]\( n \)[/tex] different symbols. These symbols are the first [tex]\( n \)[/tex] symbols from the given notation list (including the symbol for 0). Decimal to N-base notations are: [tex]\( 0:0, 1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8, 9:9, 10:A, 11:B \)[/tex] and so on up to [tex]\( 35:Z \)[/tex].

Implement the following function:

```cpp
char DectoNBase(int n, int num);
```

The function accepts positive integers `n` and `num`. Implement the function to calculate the n-base equivalent of `num` and return the same as a string.

Steps:
1. Divide the decimal number `num` by `n`. Treat the division as an integer division.
2. Write down the remainder (in n-base notation).
3. Divide the quotient again by `n`. Treat the division as an integer division.
4. Repeat steps 2 and 3 until the quotient is 0.
5. The n-base value is the sequence of the remainders from the last to first.

Assumption:
[tex]\[ 1 \ \textless \ n \leq 36 \][/tex]

Example:

Input:
```
n: 12
num: 718
```

Output:
```
BA
```

Explanation:*

| num | divisor | quotient | remainder |
|-----|---------|----------|-----------|
| 718 | 12 | 59 | 10 (A) |
| 59 | 12 | 4 | 11 (B) |
| 4 | 12 | 0 | 4 (4) |

On reversing remainders, output becomes `4BA`.

Sample Input:
```
n: 31
```



Answer :

To convert a decimal number to an n-base number, you follow a systematic division and remainder process. Let's go through the steps with an example where the base [tex]\( n = 12 \)[/tex] and the decimal number [tex]\( \text{num} = 718 \)[/tex]. The goal is to express 718 in base 12.

Here is the detailed step-by-step process:

1. Divide the decimal number 718 by 12:
- Quotient = 718 // 12 = 59
- Remainder = 718 % 12 = 10

At this step, the remainder is 10. In base 12 notation, remainders above 9 are represented by letters. So, 10 is represented as 'A'. We store this character.

2. Next, take the quotient 59 and divide by 12 again:
- Quotient = 59 // 12 = 4
- Remainder = 59 % 12 = 11

The remainder is 11, which is 'B' in base 12 notation. We store this character.

3. Repeat the division process with the new quotient 4:
- Quotient = 4 // 12 = 0
- Remainder = 4 % 12 = 4

Since the quotient has reached 0, we stop here. The last remainder is 4, and in base 12 notation, it remains '4'. We store this character as well.

4. Collect the remainders:
- The remainders collected in reverse order are: 'A', 'B', '4'.

5. Construct the n-base number by reversing the collected remainders:
- Reversing the sequence we get: '4', 'B', 'A'

Thus, the decimal number 718 converted to base 12 is 4BA.

In conclusion, to convert any decimal number to a different base [tex]\( n \)[/tex]:

- Divide the number by [tex]\( n \)[/tex] and note the remainder.
- Continue dividing the resulting quotient by [tex]\( n \)[/tex] until the quotient is zero, noting the remainders at each step.
- The required n-base number is formed by reversing the order of the remainders.