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

  1. /* INTRO12.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.    else {
  16.       printf("Your number is odd.\n");
  17.       printf("Are you odd, too?\n");
  18.    }
  19.    printf("That's all, folks!\n");
  20.  
  21.    return 0;
  22. }
  23.