home *** CD-ROM | disk | FTP | other *** search
/ C by Discovery (4th Edition) / C_By_Discovery_4th_Edition.tar / C_By_Discovery_4th_Edition / _DISK_ / ch4 / scores.c < prev    next >
C/C++ Source or Header  |  2005-06-16  |  787b  |  27 lines

  1. /*                        scores.c
  2.  *
  3.  *   Synopsis  - Accepts input of 10 integers from the keyboard
  4.  *               into an array of ints.
  5.  *   Objective - Illustrates basic array definition and
  6.  *               access of array elements. Includes an example
  7.  *               of specifying a minimum field width in a
  8.  *               printf() call.
  9.  */
  10.  
  11. /* Include Files */
  12. #include <stdio.h>
  13.  
  14. int main( void )
  15. {
  16.      int test_scores[10];              /* Note 1 */
  17.      int i;
  18.  
  19.      printf( "Please enter the ten test scores now.\n" );
  20.      for ( i = 0; i < 10; i++ ) {          /* Note 2 */
  21.           printf( "#%2d > ", i+1 );        /* Note 3 */
  22.           scanf( "%d", &test_scores[i] );  /* Note 4 */
  23.      }
  24.      printf( "Thank you.\n" );
  25.      return 0;
  26. }
  27.