Solution Review: Recursive Base Converter
Follow the step-by-step instructions to the recursive base converter.
We'll cover the following...
Solution
See the code given below!
Press + to interact
#include <stdio.h>void converter ( int n, int base ) ;int main( ){int num, base ;num = 18 , base = 16;converter ( num, base ) ;return 0 ;}void converter ( int n, int base ){int r ;r = n % base ;n = n / base ;if ( n != 0 )converter ( n, base ) ;if ( r <= 9 )printf ( "%d", r ) ;elseprintf ( "%c", 'A' + r % 10 ) ;}
Explanation
Follow the flow of control. Assuming the value of n
is 18, and ...