Call/WhatsApp: +1 914 416 5343

Base conversion tool using command line

Implement a base conversion tool called nt. It converts numbers expressed in bases 2, 10, and 16 into the other two bases.
use command line arguments in C
You must implement the base conversions yourself, without using C library printf(), scanf(), or atoi()
$ ./nt 10 -o 2


$ ./nt 0xFF -o 10


$ ./nt 0b11011110101011011011111011101111 -o 16

$ ./nt 0b11111111111111111111111111111111 -o 10
$ ./nt 0x0000000B -o 10
$ ./nt 0b123 -o 2
Bad input


Pseudocode: uint32_t string_to_int(char *str);
init retval to 0
init placeval to 1 (anything to the 0 power is 1)
loop over str from the highest index down to 0
calculate the integer corresponding to the character at that index
calculate the value of that place by multiplying the integer * placeval
add the value to the retval
update to placeval to placeval * base
return the return value
Pseudocode: void int_to_string(uint32_t value, char *str, int base);
init buffer to empty
while value != 0
quot = value / base
rem = value % base
calculate the character value of rem
append the character value to the buffer
value = quot
copy buffer into str in reverse order