This blog is for Automation Test Engineers

Saturday, 2 September 2017

Swapping two numbers without using 3rd variable




int a=3;
int b=1;

a=a+b;//4
b=a-b;//3
a=a-b;//1
System.out.println("After Swapping the value of x will be:"+x "and y:" +y);

0

0 comments:

Post a Comment