admin@onlinelearningcenter.in (+91) 7 999 01 02 03

Swap 2 Numbers without using third Variable

Suraj Ghimire
42 Posts

WAP to swap 2 numbers without using third Variable.

Usually we write something like this.

int num1=5;

int num2=10;

int temp=num1;

num1=num2;

num2=temp;

But we used third variable here. So you should not use third variable.

Published By : Suraj Ghimire
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Comments

Jquery Comments Plugin