Swapping with three number:

What is swapping three numbers:

Given three numbers, swap them in cyclic form. First number should get the value of third, second should get the value of first and third should get value of second.

Example:

public class SwappingThree 
{
public static void main(String[] args)
{
	int no1=10;
	int no2=20;
    int no3=30;
	no1=no3-no1;
	no3=no3-no1;
	no2=no1+no3;
	{
		System.out.println(no1);
		System.out.println(no2);
		System.out.println(no3);
	}
}
}

output:

Leave a Comment