CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
using namespace std;
int sum(int a, int b){
while(b != 0)
{
int carry= a & b;
a = a ^ b;
b = carry << 1;
}
return a;
}
int main() {
cout << sum(10,20);
return 0;
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run