The best programs are written so that computing machines can perform
them quickly and so that human beings can understand them clearly. A programmer is ideally an essayist
who works with traditional aesthetic and literary forms as well as mathematical concepts, to
communicate the way that an algorithm works and to convince a reader that the results will be correct.
― Donald E. Knuth

Problem :-
Add two numbers without using any airthmetic operator.

Solution :-
We use the same logic which is used in digital adder. Sum = bit1 XOR bit2. Carry = bit1 AND bit2.
See the recursive logic implementation below.

#include<iostream>using namespace std;
// Add two no.s with using any airthmetic operatorint add(int a, int b) {
if (b == 0) {
// boundary case when there is no carryreturn a;
}
// find sum and carry and recursively call add
// till carry is 0int sum = a ^ b;
int carry = (a & b) << 1;
return add(sum, carry);
}
int main() {
int a = 15;
int b = 17;
int sum = add(a,b);
cout<<"\nSum of "<<a<<" & "<<b<<" is "<<sum;
cout<<endl;
return 0;
}

#include<iostream>using namespace std;
// Add two no.s with using any airthmetic operatorint add(int a, int b) {
if (b == 0) {
// boundary case when there is no carryreturn a;
}
// find sum and carry and recursively call add
// till carry is 0int sum = a ^ b;
int carry = (a & b) << 1;
return add(sum, carry);
}
int main() {
int a = 15;
int b = 17;
int sum = add(a,b);
cout<<"\nSum of "<<a<<" & "<<b<<" is "<<sum;
cout<<endl;
return 0;
}