home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 98.img / LCNOW2.ZIP / EXAMPLES / MINIMUM.C < prev    next >
C/C++ Source or Header  |  1988-07-25  |  650b  |  34 lines

  1. /*
  2.  * M I N I M U M
  3.  *
  4.  * This program determines the lesser of two
  5.  * numbers supplied by the user.
  6.  */
  7.  
  8. main()
  9. {
  10.     int lesser;        /* the result */
  11.     int number1, number2;    /* the input values */
  12.  
  13.     /*
  14.      * Prompt the user for two numbers and read them.
  15.      */
  16.     printf("Type the first number and press Enter: ");
  17.     scanf("%d", &number1);
  18.     printf("Type the second number and press Enter: ");
  19.     scanf("%d", &number2);
  20.  
  21.     /*
  22.      * Find the lesser value and report it.
  23.      */
  24.     if (number1 < number2)
  25.         lesser = number1;
  26.     else
  27.         lesser = number2;
  28.  
  29.     printf("The lesser of %d and %d is %d.\n",
  30.         number1, number2, lesser);
  31.  
  32.     return (0);
  33. }
  34.