We want to convert an integer number into any base B between 2 and 35 (e.g to base 5 or to base 16 or to base
8) and build the corresponding string (e.g. the value X=143 in base B=2 is “10001111” while in base B=16 is “8F” and in base B=8 is “217”).
Write the C function: int convert_to_base(int B, int X, char text[], int N) receiving the arguments:
– an integer X
– the base B (integer between 2 and 35)
– a char array text of length N where the function should build X represented in base B. NOTICE: digits greater than 9 are encoded by the characters A .. Z as follows:
A = 10, B = 11, C = 12, D = 13, ..., X = 33, Y = 34, Z = 35

## Comments

## Leave a comment