Swap without third or temp variable of two number main logic in c , c++ ,java ,plsql
i made this video because i also stuck or confuse in that logic so pls dont confuse understand the logic:-
logic is
suppose user entered the value of a=20 and b=40
main logic is
a=a+b; // here the value of become 60
b=a-b// preivious value is a=60 then finally b=20
a=a-b;//preivious value is b=20 - a=60 then a=40
after the swaping a=40 and b=20
swaping is done done !
No comments:
Post a Comment