You can experiment with recursive_power_of_2
in a program such as
this:
#include/* Define recursive_power_of_2 function: */ int recursive_power_of_2 (int n) { if (n == 0) return 1; else return 2 * recursive_power_of_2 (n - 1); } /* Test recursive_power_of_2 function in main: */ main ( ) { printf ("The 0th power of 2 is %i.\n", recursive_power_of_2 (0)); printf ("The 1st power of 2 is %i.\n", recursive_power_of_2 (1)); printf ("The 2nd power of 2 is %i.\n", recursive_power_of_2 (2)); printf ("The 3rd power of 2 is %i.\n", recursive_power_of_2 (3)); }