Program to show swap of two no’s without using third variable.

इस प्रोग्राम में हम जानेगे कि किस प्रकार हम C लैंग्वेज के प्रोग्राम में उपयोग किए गए दो वेरिएबल में रखी हुई संख्याओ को किसी और वेरिएबल कि मदद के बिना आपस में बदलेंगे अर्थात जेसे वेरिएबल a = 5 तथा b = 6 है तो कैसे a = 6 तथा b = 5 कर सकते है |

#include<stdio.h>
#include<conio.h>
void main()
{
  int a,b;
  clrscr();
  printf("enter value for a & b: ");
  scanf("%d%d",&a,&b);
  a=a+b;
  b=a-b;
  a=a-b;
  printf("\nafter swapping the value of a & b: %d %d",a,b);
  getch();
}

Output:
enter value for a & b: 5
6
after swapping the value of a & b: 6 5


error: Content is protected !!