home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / tyc / list4_3.c < prev    next >
C/C++ Source or Header  |  1993-10-16  |  559b  |  29 lines

  1.    /* Demonstrates the use of if statements */
  2.  
  3.    #include <stdio.h>
  4.  
  5.    int x, y;
  6.  
  7.    main()
  8.    {
  9.        /* Input the two values to be tested */
  10.  
  11.       printf("\nInput an integer value for x: ");
  12.       scanf("%d", &x);
  13.       printf("\nInput an integer value for y: ");
  14.       scanf("%d", &y);
  15.  
  16.       /* Test values and print result */
  17.  
  18.       if (x == y)
  19.           printf("x is equal to y");
  20.  
  21.       if (x > y)
  22.           printf("x is greater than y");
  23.  
  24.       if (x < y)
  25.           printf("x is smaller than y");
  26.  
  27.       return 0;
  28.   }
  29.