Bases of a number

we have a number n. We have to calculate the the number in all the bases to n-1
so for example if we have 5, we need base 2, 3 and 4
and also we need to calculate and show the sum of the digits of the numbes in each base. In c++
the number n can be anywhere from 2 to 62

and the values go like this
A - 10
B - 11
C - 12
...
a - 36
b - 37
...
z - 61
What is the problem in your code?
there isn't a problem, i was just wondering if somebody could help me
Break the program into smaller tasks. Tackle each task.
I tried, but I ahve no ideea of how to transform n into the other bases
In maths, do you know how to convert a number in base 10 to another base?

The general steps for converting a base 10 or "normal" number into another base are: First, divide the number by the base to get the remainder. Then repeat the process by dividing the quotient of step 1, by the new base. This time, the remainder is the second digit, ie the second least significant.

First you need to understand this and know how to do this using pen/paper.Then you convert these steps into an algorithm, test, then from this produce a program design. Last you code the program from the design.
Thank you a lot!
If n only goes up to 62 ... where would you use the lower-case digits a-z? The highest sum you can get is 31 (V) and the highest used digit is 30 (U).

Also, the problem is meaningless for n=2.
Last edited on
Topic archived. No new replies allowed.