23. WAP to swap 2 numbers using bitwise operator

 

#include<stdio.h>

void main()

{

  int i,j;

  printf("Enter value of i :  ");

  scanf("%d",&i);

  printf("Enter value of j : ");

  scanf("%d",&j);

 

  i=i^j;

  j=i^j;

  i=i^j;

 

  printf("Value of i = %d and j = %d\n",i,j);

}

Comments