Skip to content

Commit 42522be

Browse files
Merge pull request akshitagit#10 from utk09/add
Add [issue akshitagit#2]
2 parents cf05ec8 + 2c0563a commit 42522be

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

DailyCode/add

Lines changed: 0 additions & 1 deletion
This file was deleted.

DailyCode/add/add-without-plus.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
function add(num1, num2){
2+
while(num2!=0){
3+
carry = num1 & num2 //carry
4+
num1 = num1 ^ num2
5+
num2 = carry << 1
6+
}
7+
return num1
8+
}
9+
10+
console.log(add(5, 7))

0 commit comments

Comments
 (0)