![]() |
|
|
#1 |
|
Senior Member
Join Date: Aug 2011
Posts: 110
|
swaping two numbers with the use of third variable
PHP Code:
Code:
10 20 20 10 PHP Code:
Code:
10 20 20 10 |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Aug 2011
Posts: 111
|
Very useful.
Though both examples give same result, I prefer using first approach. The second approach requires extra processes for addition and subtraction. What do you think??? |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Aug 2011
Posts: 110
|
yah first one is quit good but second one is maths trick!!!!!!!!
|
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Aug 2011
Posts: 111
|
Agree. the second one is the magic of mathematics. I tried with negative numbers and with decimal too. Always works fine.
|
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Aug 2011
Posts: 110
|
It takes a big penalty if you do not enjoy Mathematics
|
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Aug 2011
Posts: 111
|
How is the penalty given? Clarify.
|
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Aug 2011
Posts: 110
|
It is a pharse : AGAR MATH SAMAJH AA JAYE TO MAJA NAHI TO MATH HAI EK SAJA
|
|
|
|
|
|
#8 |
|
Senior Member
Join Date: Aug 2011
Posts: 111
|
Okay....
|
|
|
|
|
|
#9 |
|
Senior Member
Join Date: Aug 2011
Posts: 110
|
thanks you have taken such an interest.
|
|
|
|
![]() |
| Tags |
| swaping two numbers |
| Thread Tools | |
| Display Modes | |
|
|