HOW CAN I SWAP TWO VARIABLES WITHOUT USING A THIRD VARIABLE?

Rajesh Goswami

Total Post:29

Points:203
Posted by  Rajesh Goswami
Java 
 1494  View(s)
Ratings:
Rate this:

Problem in making a swap program in java without using a third variable.

 

  1. Amit Singh

    Post:103

    Points:721
    Re: How can I swap two variables without using a third variable?

    we can swap using only two variable for example

    int a=5,b=10;a=a+b; b=a-b; a=a-b;

    check it.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!