Created
November 14, 2013 17:54
-
-
Save whyrusleeping/7471265 to your computer and use it in GitHub Desktop.
Lab 12 Solutions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int recursive_sum(int num) { | |
int ones = num % 10; | |
if (num == 0 ) { | |
return 0; | |
} | |
return ones + recursive_sum(num / 10); | |
} | |
void reverse_string(char *start, char *end) { | |
char temp; | |
if (start >= end) { | |
return; | |
} | |
temp = *start; | |
*start = *end; | |
*end = temp; | |
reverse_string(start + 1, end - 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment