+ 2
how to swap a number without using third variable and without alphabetic letters
3 Answers
+ 7
I'm not sure if this is what you want: but if you have two numbers, you can swap them without a third variable with a code like this:
firstNum += secondNum;
secondNum = firstNum - secondNum;
firstNum -= secondNum;
+ 2
suppose i have 2 variables a=5 and b=4 and we want to swap values without any other variable then
a=a+b ; // a=9 new value
b=a-b; // b=9-4=5
a=a-b; // a=9-5 =4
0
can you explain what you whant to do a bit better please?