max-xor.c 366 B

123456789101112131415
  1. #include <stdio.h>
  2. int main (int argc, char **argv) {
  3. int ctr1, ctr2, lim1, lim2, max = 0;
  4. scanf ("%d", &lim1);
  5. scanf ("%d", &lim2);
  6. for (ctr1 = lim1; ctr1 <= lim2; ++ctr1) {
  7. for (ctr2 = lim1; ctr2 <= lim2; ++ctr2) {
  8. int temp = ctr1 ^ ctr2;
  9. if (temp > max) { max = temp; }
  10. }
  11. }
  12. printf ("%d\n", max);
  13. }