Skip to content

Commit 2d491fd

Browse files
committed
swap
1 parent 3cc79c5 commit 2d491fd

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Programs/DSA/swap.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
/*
3+
4+
WAP in Js Function SWAP Two Numbers
5+
6+
input -5 6
7+
8+
Output - 6 5
9+
*/
10+
11+
12+
function swap(a, b){
13+
14+
a=a+b
15+
b=a-b
16+
a=a-b
17+
18+
console.log("After Swaping =" ,a,b)
19+
}
20+
21+
swap(5,6) // 6 5
22+
swap(10,20)//20 10

0 commit comments

Comments
 (0)