Write a C program to swap
the value of two integers without using third variable

#include <stdio.h>
int main() 
    int x, y;
    printf("Enter two integers: ");
    scanf("%d %d", &x, &y);
    printf("Before swapping: x = %d, y = %d\n", x, y);
    // Swap the values of x and y
    x = x + y;
    y = x - y;
    x = x - y;
    printf("After swapping: x = %d, y = %d\n", x, y);
    return 0;


Leave a Reply

Your email address will not be published. Required fields are marked *