/* File: min1.c Report the smallest item entered by the user. */ #include int main() { int min, n, count ; printf("Enter some numbers. When you are done, type 'quit'.\n") ; // Sepcial case for the first number, to initialize the min. printf("? ") ; count = scanf("%d", &n) ; if (count == 0) { printf("No numbers entered!\n") ; } else { min = n ; // initially, first number is smallest. printf("? ") ; count = scanf("%d", &n) ; while (count > 0) { if (n < min) { min = n; } // debug printf("*** Current smallest number = %d ***\n", min) ; // get more input printf("? ") ; count = scanf("%d", &n) ; } // end of whle loop printf("The smallest number is: %d\n", min) ; } // end of else part return 0 ; }