C Program to swap two numbers without using third variable. / सी तीसरे चर का उपयोग किए बिना दो नंबर स्वैप करने का कार्यक्रम।












C Program to swap two numbers without using third variable




C Program to swap two numbers without using third variable



#include <stdio.h> int main() { int x,y; printf("\n Enter x value :"); scanf("%d",&x); printf("\n Enter y value :"); scanf("%d",&y); printf("\n Before swapping x value: %d",x); printf("\n Before swapping y value: %d",y); x=x+y; y=x-y; x=x-y; printf("\n After swapping x value: %d",x); printf("\n After swapping y value: %d",y); return 0; }


Output:
Enter x value :500 Enter y value :800 Before swapping x value: 500 Before swapping y value: 800 After swapping x value: 800 After swapping y value: 500