Skip to content

Commit

Permalink
Merge pull request keshavsingh4522#341 from Madhurima-Ghosh/patch-1
Browse files Browse the repository at this point in the history
Create swap_xor.c
  • Loading branch information
keshavsingh4522 committed Oct 2, 2021
2 parents 563757c + ef0e4df commit fd1e0a4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions C/swap_xor.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//swapping without using 3rd variable
//xor bitwise operator
#include<stdio.h>
int main()
{
int a, b;
printf("Enter value of a:");
scanf("%d",&a);
printf("Enter value of b:");
scanf("%d", &b);
a=a^b;
b=a^b;
a=a^b;
printf("After swapping:\na=%d", a);
printf("\nb=%d", b);
}

0 comments on commit fd1e0a4

Please sign in to comment.