Algorithm to swap two numbers without using a third variable.

1. Start.

2. Read two numbers. (let, a and b)

3. Initialize,  a=a+b;
                        b=a-b;
                        a=a-b;

4.Print numbers.

5.End.

No comments:

Post a Comment