Skip to content

p013.c

Problem Statement

WAP to swap two integer variable without using third variable

Metadata

Property Detail
Author Amit Dutta (amitdutta4255@gmail.com)
License MIT

Actions

Raw View on GitHub

💡 You can print or save this file by opening Raw and using your browser.

Source Code

#include<stdio.h>
#include<math.h>
int main() {
    int a = 4, b = 6;
    printf("Before Swap : A = %d, B = %d", a, b);
    a = a ^ b;
    b = a ^ b;
    a = a ^ b;
    printf("\nAfter Swap : A = %d, B = %d", a, b);
    return 0;
}