/* File: num2string.c Convert number to string. */ #include #include #include int main() { char prompt[1000] ; int low, high, n ; char *str ; // These low & high values might be // computed by some weird function low = 3 ; high = 12 ; sprintf(prompt, "Enter a number between %d and %d (inclusive): ", low, high) ; str = readline(prompt) ; // sscanf(str, "%d", &n) ; n = atoi(str) ; printf("You entered n = %d\n", n) ; if ( n >= low && n <= high ) { printf("Thank you!\n") ; } else { printf("Please follow instructions!\n") ; } free(str) ; return 0 ; }