Skip to content

Instantly share code, notes, and snippets.

@valo
Created December 13, 2015 20:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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