Standard Swap problem

public class SwapVariables
{
public static void main(String args[])
{
int a=5;
int b= 6;

System.out.println(“Before Swap :”+a+” “+b);

a=a+b;
b=a-b;
a=a-b;

System.out.println(“After Swap :”+a+” “+b);

}
}


Comments

Leave a Reply

Discover more from Chai's Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading