/**
Program Name: Swap Two Numbers
Description: This Program swaps two number, using XOR
Author: Tauqirul Haque
*/
#include <stdio.h>
#include <conio.h>
int main()
{
int firstNumber, secondNumber;
printf("Enter The First Number : ");
scanf("%d",&firstNumber);
printf("\nEnter The Second Number : ");
scanf("%d",&secondNumber);
printf("\n\nNumbers Before Swapping : %d <-> %d \n",firstNumber, secondNumber);
firstNumber = firstNumber^secondNumber;
secondNumber = firstNumber^secondNumber;
firstNumber = firstNumber^secondNumber;
printf("\nNumbers After Swapping : %d <-> %d \n",firstNumber, secondNumber);
}
Program Name: Swap Two Numbers
Description: This Program swaps two number, using XOR
Author: Tauqirul Haque
*/
#include <stdio.h>
#include <conio.h>
int main()
{
int firstNumber, secondNumber;
printf("Enter The First Number : ");
scanf("%d",&firstNumber);
printf("\nEnter The Second Number : ");
scanf("%d",&secondNumber);
printf("\n\nNumbers Before Swapping : %d <-> %d \n",firstNumber, secondNumber);
firstNumber = firstNumber^secondNumber;
secondNumber = firstNumber^secondNumber;
firstNumber = firstNumber^secondNumber;
printf("\nNumbers After Swapping : %d <-> %d \n",firstNumber, secondNumber);
}
Comments