digits_to_number
This file contains 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
#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