Skip to content

Instantly share code, notes, and snippets.

@valo
Created December 13, 2015 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save valo/d0282b0ce3e41b0ba6dc to your computer and use it in GitHub Desktop.
Save valo/d0282b0ce3e41b0ba6dc to your computer and use it in GitHub Desktop.
digits_to_number
#include <stdio.h>
int sample_input[] = {1,6,4, 10};
int loc = 0;
int getnumber() {
return sample_input[loc++];
}
int main() {
int result = 0;
int input = getnumber();
while (input != 10) {
result = result * 10 + input;
input = getnumber();
}
printf("%d\n", result);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment