swapping of two numbers using bitwise operator

Solutions on MaxInterview for swapping of two numbers using bitwise operator by the best coders in the world

showing results for - "swapping of two numbers using bitwise operator"
Silvana
26 Mar 2017
1#include<stdio.h>
2
3int main()
4{
5	int a, b;
6
7	scanf("%d%d", &a, &b);
8
9	//Write your code here
10	a=a^b;
11	b=a^b;
12	a=a^b;
13	printf("%d %d", a, b);
14	
15	return 0;
16}
Thiago
26 Sep 2016
1#include<stdio.h>
2void main()
3{
4    int a,b;
5    printf("Enter the value of a and b: ");
6    scanf("%d %d", &a, &b);
7    a = a^b;
8    b = b^a;
9    a = a^b;
10    printf("Value of a is: %d\n", a);
11    printf("Value of b is: %d\n", b);
12}