+ 1

Write program addition of two numbers don't use (+ plus)operator

28th Feb 2018, 5:11 PM
chavan dipak dattatray
chavan dipak dattatray - avatar
8 Respostas
+ 5
int a=5,b=6; System.out.println("5+6="+(a-(-b)));
28th Feb 2018, 5:40 PM
John Wells
John Wells - avatar
+ 3
print( - ( - int(input()) - int(input()) )) # Not used + operator ;)
28th Feb 2018, 5:16 PM
777
777 - avatar
+ 2
@Blue I'd call you clever except for the fact that you used Python instead of Java. :D Either way, good job.
28th Feb 2018, 5:39 PM
Fata1 Err0r
Fata1 Err0r - avatar
+ 2
@ace I thought that the increment operators ( ++c/ c++) are not same as the + addition operator which is a binary operator. lemmie think of another way then.
28th Feb 2018, 7:33 PM
MÎDÅŞ
MÎDÅŞ - avatar
+ 1
int add (int x, int y) { return y ? add (x^y, (x&y)<<1):x; }
28th Feb 2018, 7:08 PM
chavan dipak dattatray
chavan dipak dattatray - avatar
+ 1
my c++ try #include <iostream> using namespace std; int main() { // adding two numbers without + operator int x, y, sum=0; cout << "enter two integers to add "<<endl; cin >> x >> y; cout << endl; for (int i=0; i< x; i++) { sum++; } for ( int j=0; j<y; j++){ ++sum; } cout<<"sum of " <<x<<" and "<<y <<" is: "<<sum; return 0; }
28th Feb 2018, 7:18 PM
MÎDÅŞ
MÎDÅŞ - avatar