#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf("enter value for a & b: \n");
scanf("%d%d",&a,&b);
printf("Before swapping the value of a=%d & b=%d \n",a,b);
a=a+b;
b=a-b;
a=a-b;
printf("After swapping the value of a=%d & b=%d \n",a,b);
}
enter value for a & b:
2 3
Before swapping the value of a=2 & b=3
After swapping the value of a=3 & b=2
Press any key to continue . . .
First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.
Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.