N-base notation is a system for writing numbers which uses only n
different symbols. These symbols are the first n symbols from the
given notation list (including the symbol for 0). Decimal to n-base
notations are {0:0, 1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8, 9:9, 10:A,
11:B and so on up to 35:Z}.
Implement the following function:
char* DectonBase(int n, int num);
The function accepts positive integers 'n' and 'num'. Implement the
function to calculate 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 step 2 and 3 until quotient is 0.
5. The n-base value is the sequence of the remainders from the
last to first.
Assumption: 1< n <= 36
Example:
Input:
n: 12
num: 718
Output:
4BA
Explanation:
divisor quotient remainder
718 12
59
10 (A)
59 12
4
11 (B)
4
0
4 (4)
On reversing remainders, output becomes 4BA.
num
12
Sample Input
Answers
Answered by
0
Answer:
dudh what are you writing
Explanation:
are you writing question or answer see how much the length of the equation is what yaar yah sab Nahin chalega Itna Bada question answer likh de yeah notation quotation kya hai bhai PTET 201 Asian tour sample import output different symbol and 20 notation in the system pata nahin hai mere ko Aata Nahin dusra koi bhi deta Yahi
Similar questions