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 DectolNBase(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 dedstal 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
Answers
Answered by
0
N-base notation is a system for writing numbers which uses only n
- The base-2 numeral system, often known as the binary numeral system, is a way of expressing numbers in mathematics that employs just two symbols, commonly "0" (zero) and "1." (one).With a radix of 2, the base-2 number system is a positional notation.
- A bit, or binary digit, is the term used to describe each digit. The binary system is used by almost all modern computers and computer-based devices as a preferred system of use over various other human techniques of communication because of the simplicity of the language and the noise immunity in physical implementation. This is due to its straightforward implementation in digital electronic circuitry using logic gates.
Attachments:
Similar questions