Skip to content

Instantly share code, notes, and snippets.

@sbmueller
Created November 2, 2017 13:23
Show Gist options
  • Save sbmueller/8dc356ae84f366011800efe40e021ab5 to your computer and use it in GitHub Desktop.
Save sbmueller/8dc356ae84f366011800efe40e021ab5 to your computer and use it in GitHub Desktop.
Recursive number base converter
#include <stdio.h>
int convert(int number, unsigned int base) {
if(number == 0) {
return number;
}
return number % base + 10*convert(number/base, base);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment