adsense

Hii, welcome to my site. My name is Om prakash kartik. This blog helps you to learn programming languages concepts.

program in c++ to swap two numbesr using Bitwise operator

Program in C++ to swap two numbers using Bitwise operator


#include<iostream>
#include<conio.h>
 using namespace std;
 int main()
 {
     int a,b;
     cout<<"Enter two numbers:-";
     cin>>a>>b;
     cout<<"Before swapping value of a="<<a<<" and value of b="<<b;
     a=a^b;
     b=b^a;
     a=a^b;
     cout<<"\nAfter swapping value of a="<<a<<" and value of b="<<b;
     getch();
 }
Output :-





Post a Comment

0 Comments