+ 1

Issue for var

Var a=10; Var b=20; Print a value 20 And second print b value 10 Not use thard var

28th Feb 2017, 7:20 PM
garvish bhardwaj
garvish bhardwaj - avatar
2 Answers
+ 4
previous one will work in python. u can try following logic: a=a+b b=a-b a=a-b this will work in all languages.
28th Feb 2017, 7:37 PM
Mohit Khokhar
Mohit Khokhar - avatar
+ 3
for swapping values without using any extra variables: a=10 b=20 a,b = b,a print(a,b) output: 20 10
28th Feb 2017, 7:26 PM
Mohit Khokhar
Mohit Khokhar - avatar