+ 5

# Add two numbers without plus symbol

25 ответов

+ 16

System.out.print (-(-a-b));
//😂😂😂😂😂😂 ☝☝☝
/*what ??? , it satisfies the condition , not to use + sign */
//take values a& b in double (+ve,-ve,0 all will work)😂😂😂

+ 15

Here is one of my earlier codes (the whole code is without any operator of +, - ,* , / ) :
https://code.sololearn.com/cY3G5MvgPbGi/?ref=app

+ 15

//3 methods , comment your favourite1 ☺
https://code.sololearn.com/csfPlMqLV9IL/?ref=app

+ 13

Addition _without _addOperator
(Using bitwise operators)
https://code.sololearn.com/cE9Cgwlhn4Iy/?ref=app

+ 12

Is this ok ? (in Java)
Adding two numbers without '+' operator.
(Using ' - ' operators.)
https://code.sololearn.com/c9ojEcmQNINQ/?ref=app

+ 11

import java.util.Scanner;
public class Bitwise_Addition {
static int add(int x, int y) {
int carry;
while(y!=0) {
carry = x & y;
x = x ^ y;
y = carry << 1;
}
return x; }
public static void main(String args[]) {
Scanner input = new Scanner(System.in); System.out.println("Enter the numbers to be added:");
int x = input.nextInt();
int y = input.nextInt();
System.out.println("The Summation is: "+add(x, y)); input.close(); }}

+ 10

can bitwise work for decimal values also???

+ 8

Hmm how about negative negative positive? 😉

+ 7

yeah @charan just difference of syntax logic is same

+ 6

eval('2+2')
>>>
4

+ 4

https://code.sololearn.com/cjN44PFrvnyA/?ref=app
I did it!!!!!

+ 4

-(-a-b) 😂
You should change your question to:
Do numerical operations without using numerical operators. ( +, -, *, / )
Edit:
LukArToDo's code does exactly that.
☺

+ 3

Ohh. Then see this code @Venkatesh. Just enter two number and see.
https://code.sololearn.com/ckGg1ePUyb0a/#cpp

+ 3

Is incrementing allowed?

+ 3

Umm... I just did that above.

+ 3

using bitwise operators
(logically)Actual sum of A+B = binary sum + carry
proper syntax of adding sum nd carry uses shifting as @Gwaen Stasy has shown
binary sum= A (xor) B
carry =A (AND) B
in c, c++, Python symbol for AND = &, XOR = ^
some days ago i made a code for a challenge- basic calculator without using +, -, *, /
but unfortunately i don't have tht code now

+ 2

Can you please describe the question more briefly and if want to add numbers without operators added then see my code.
https://code.sololearn.com/cnSdWHB4BYUa/#cpp

+ 2

+ symbol not allowed that's the question

+ 2

Add two numbers without using plus operator