Script started on Sun Dec 05 15:07:15 2004 %cat q23.c /* q23.c Answer to Question 23, CISC105 Exam, Fall 2004 P. Conrad */ #include int main(void) { int i; /* loop counter */ int a[10]; /* array with 10 elements */ int min; /* minimum element in array */ /* prompt user for ten integers */ printf("Please enter ten integers: "); /* use scanf to get the integers and put the integers into an array */ for (i=0; i<10; i++) { scanf("%d",&a[i]); } /* print out the array on a single line */ printf("array is: "); for (i=0; i<10; i++) { printf("%d ",a[i]); } printf("\n"); /* print the minimum value in the array */ min = a[0]; for (i=1; i<10; i++) { if (a[i] < min) min = a[i]; } printf("min is: %d\n",min); return 0; } %make q23 `q23' is up to date. %rm q23 rm: remove q23 (yes/no)? yes %make q23 cc -o q23 q23.c %./q23 Please enter ten integers: 9 3 2 4 5 6 7 3 8 6 array is: 9 3 2 4 5 6 7 3 8 6 min is: 2 %exit exit script done on Sun Dec 05 15:07:45 2004