The conversation between human and AI assistant.
Write a c program to swap two numbers without using 3rd variable?
Could you help me with writing a C program to swap two numbers without using a third variable?
Sure, here is a sample program:
int a,b;
printf("Enter two numbers:");
scanf("%d %d",&a,&b);
a=a+b;
b=a-b;
a=a-b;
printf("After swapping, a=%d and b=%d",a,b);