home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c021 / 7.img / EXAMPLES.ZIP / INTRO25.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-04  |  335 b   |  18 lines

  1. /* INTRO25.C--Example from Chapter 4 of Getting Started */
  2.  
  3. #include <stdio.h>
  4.  
  5. #define EVEN(value) (((value) % 2 == 0) ? (value) : ((value) + 1))
  6.  
  7. int main()
  8. {
  9.    char inbuf[130];
  10.    int  num;
  11.    printf("Enter a number: ");
  12.    gets(inbuf);
  13.    sscanf(inbuf, "%d", &num);
  14.    printf("\n%d", EVEN(num));
  15.  
  16.    return 0;
  17. }
  18.