Computer Science, asked by subrat5750, 1 year ago

The minimum number of temp varibale to swipe two numbers

Answers

Answered by nniks
0
no need of any extra temporary variable to swap two numbers
example..

int a=10, b=5;

a=a+b; // a becomes (10+5) i.e. 15
b=a-b; // b becomes (15-5) i.e. 10
a= a-b; // a becomes (15-10) i.e. 5
hence the two no. swapped.

Similar questions