previous | start | next

Code Example

File name: ex1.c

    1   #include <stdio.h>
    2   #include <stdlib.h>
    3   
    4   int main()
    5   {
    6     int x, y;
    7     int max, min;
    8     int status;
    9   
   10     printf("\nEnter two integers separated by whitespace: ");
   11     status = scanf("%d%d", &x, &y);
   12     
   13     max = (x < y) ? y : x;
   14     min = (x < y) ? x : y;
   15   
   16     printf("You input values %d and %d\n", x, y);
   17     printf("Max = %d, Min = %d\n\n", max, min);
   18   
   19     return 0;
   20   }


previous | start | next