Advertisement
Guest User

Untitled

a guest
Oct 18th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.90 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3.   int main() {
  4.     int first, second, third, forth; //,output1, ;
  5.  
  6.     scanf("%d %d   %d %d", &first, &second, &third, &forth);
  7.  
  8.     if (first >= third) { //case 2,4,5,6,8
  9.       if (second <= forth && first <= forth) { // case 2
  10.         printf("[%d,%d]\n", first, second);
  11.       }
  12.       if (first < forth && second > forth) { // case 4
  13.         printf("[%d,%d]\n", first, forth);
  14.  
  15.       }
  16.  
  17.       if (forth < first && forth < second) { // case 8
  18.         printf("[]\n" );
  19.  
  20.       }
  21.  
  22.     }
  23.     if (third > first) { //case 1,3,7
  24.       if (second >= third && forth >= second) { //case 1
  25.         printf("[%d,%d]\n", third, second );
  26.  
  27.       }
  28.       if (second > third && second > forth) { //case 3
  29.         printf("[%d,%d]\n",third, forth );
  30.  
  31.       }
  32.       if (second < third && second < forth) { //case 7
  33.         printf("[]\n");
  34.  
  35.       }
  36.  
  37.     }
  38.  
  39.    
  40.     return 0;
  41.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement