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

  1. /* INTRO11.C--Example from Chapter 4 of Getting Started */
  2.  
  3. #include <stdio.h>
  4.  
  5. int main()
  6. {
  7.    char  inbuf[130];
  8.    int   your_number;
  9.    printf("Enter a whole number: ");
  10.    gets(inbuf);
  11.    sscanf(inbuf, "%d", &your_number);
  12.  
  13.    if (your_number % 2 == 0)
  14.       printf("Your number is even\n");
  15.  
  16.    if (your_number % 2 != 0) {
  17.       printf("Your number is odd.\n");
  18.       printf("Are you odd, too?\n");
  19.    }
  20.    printf("That's all, folks!\n");
  21.  
  22.    return 0;
  23. }
  24.