Skip to content

Commit 0aa4d65

Browse files
committed
Swap Two Numbers
1 parent 5df2d5e commit 0aa4d65

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

Programs/Basic/swap.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
3+
4+
/*
5+
6+
WAP Swap Two Numbers
7+
*/
8+
9+
let a=10;
10+
let b=20;
11+
console.log("Before Swap = ",a,b)
12+
a=a+b;
13+
b=a-b
14+
a=a-b
15+
16+
console.log("After Swap = ",a,b)
17+
18+
19+
let c=50
20+
let d=60
21+
console.log("Before Swap =",c,d)
22+
let t=c //50
23+
c=d //60
24+
d=t;//50
25+
console.log("After Swap = ",c,d)
26+

0 commit comments

Comments
 (0)