+ 1
Write program addition of two numbers don't use (+ plus)operator
8 Respostas
+ 5
int a=5,b=6;
System.out.println("5+6="+(a-(-b)));
+ 3
print( - ( - int(input()) - int(input()) ))
# Not used + operator ;)
+ 2
@Blue
I'd call you clever except for the fact that you used Python instead of Java. :D Either way, good job.
+ 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.
+ 1
int add (int x, int y)
{
return y ? add (x^y, (x&y)<<1):x;
}
+ 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;
}