t805

Integer Comparison

Sep 10th, 2014
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5.     int x, y;
  6.  
  7.     printf("Enter number 1: ");
  8.     scanf("%d%*c", &x);
  9.  
  10.     printf("Enter number 2: ");
  11.     scanf("%d%*c", &y);
  12.  
  13.     if(x == y)
  14.         printf("Both values are equal\n");
  15.     else
  16.         if(x > y)
  17.             printf("The first value is greater than the second value.\n");
  18.         else
  19.             printf("The second value is greater than the first value.\n");
  20.  
  21.     return(0);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment