The Tech World..!!

C Program for Swapping of 2 Numbers using Bitwise Operator


#include<stdio.h>

int main()
{
         int a, b ;
         printf("Enter 2 Numbers \n");
         scanf("%d \t %d",&a,&b);

         a = a ^ b ;
         b = a ^ b ;
         a = b ^ a ;

        printf("The swapped Numbers are ");
        printf("a = %d \t b= %d \n",a,b);

       return 0;


}
Posted by Geetanjali Killari No comments:
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Older Posts Home
Subscribe to: Comments (Atom)
Powered By Blogger

Search This Blog

  • Armstrong Number
  • C Program to find the GCD of 2 Numbers
  • C Program to find the HCF of 2 Numbers
  • C Program to find the LCM of 2 Numbers
  • C Program to swap 2 Numbers
  • C Program to swap 2 Numbers using bitwise operator
  • C Program to swap 2 Numbers using third variable
  • C Program to swap 2 Numbers using XOR operator
  • C Program to swap 2 Numbers without using third variable
  • Computer Hardware and Software
  • Conversion from Decimal to Binary Number
  • Conversion from Decimal to Hexadecimal Number
  • Conversion from Decimal to Octal Number
  • HTML
  • Introduction
  • Top Down Approach and Bottom Up Approach

Wiki

Search results

Geetanjali Killari. Simple theme. Theme images by luoman. Powered by Blogger.