Maximizing XOR : HackerRank Problem Solution

Maximizing XOR : HackerRank Problem Solution


C Implementation:

#include<stdio.h>
int main()
{
 int L,R,max=0,i,j,xr;
 scanf("%d",&L);
 scanf("%d",&R);
 for(i=L;i<=R;i++)
 {
  for(j=i+1;j<=R;j++)
  {
   xr=i^j;
   if(xr>max)
    max=xr;
  }
 }
 printf("%d\n",max);
 return 0;
}