/* File: min1.c Report the smallest item entered by the user. Slightly buggy. */ #include // Inlcude the following to define the INT_MAX constant #include int main() { int min, n, stop ; printf("Enter some positive numbers. When you are done, type -1.\n") ; min = INT_MAX ; // everything is <= INT_MAX stop = 0 ; // don't stop while (!stop) { printf("? ") ; scanf("%d", &n) ; if (n == -1) { stop = 1 ; } else if (n < min) { min = n; } } // end of while printf("The smallest number found is: %d\n", min) ; return 0 ; }