+ 5

Add two numbers without plus symbol

30th Dec 2017, 8:39 AM
venkatesh
venkatesh - avatar
25 Respostas
+ 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)😂😂😂
30th Dec 2017, 2:16 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 15
Here is one of my earlier codes (the whole code is without any operator of +, - ,* , / ) : https://code.sololearn.com/cY3G5MvgPbGi/?ref=app
30th Dec 2017, 11:19 AM
LukArToDo
LukArToDo - avatar
+ 15
//3 methods , comment your favourite1 ☺ https://code.sololearn.com/csfPlMqLV9IL/?ref=app
30th Dec 2017, 3:10 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 13
Addition _without _addOperator (Using bitwise operators) https://code.sololearn.com/cE9Cgwlhn4Iy/?ref=app
30th Dec 2017, 11:53 AM
Danijel Ivanović
Danijel Ivanović - avatar
+ 12
Is this ok ? (in Java) Adding two numbers without '+' operator. (Using ' - ' operators.) https://code.sololearn.com/c9ojEcmQNINQ/?ref=app
30th Dec 2017, 11:14 AM
Danijel Ivanović
Danijel Ivanović - avatar
+ 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(); }}
30th Dec 2017, 10:40 AM
GAWEN STEASY
GAWEN STEASY - avatar
+ 10
can bitwise work for decimal values also???
30th Dec 2017, 2:39 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 8
Hmm how about negative negative positive? 😉
30th Dec 2017, 10:46 AM
Zephyr Koo
Zephyr Koo - avatar
+ 7
yeah @charan just difference of syntax logic is same
30th Dec 2017, 10:43 AM
GAWEN STEASY
GAWEN STEASY - avatar
+ 6
eval('2+2') >>> 4
30th Dec 2017, 8:43 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
30th Dec 2017, 10:44 AM
VortexYT
+ 4
-(-a-b) 😂 You should change your question to: Do numerical operations without using numerical operators. ( +, -, *, / ) Edit: LukArToDo's code does exactly that. ☺
30th Dec 2017, 11:25 AM
Haris
Haris - avatar
+ 3
Ohh. Then see this code @Venkatesh. Just enter two number and see. https://code.sololearn.com/ckGg1ePUyb0a/#cpp
30th Dec 2017, 9:25 AM
Akash Pal
Akash Pal - avatar
+ 3
Is incrementing allowed?
30th Dec 2017, 10:39 AM
VortexYT
+ 3
Umm... I just did that above.
30th Dec 2017, 10:50 AM
VortexYT
+ 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
30th Dec 2017, 10:58 AM
Akhil Manchanda
Akhil Manchanda - avatar
31st Dec 2017, 6:30 AM
Mohammad Asif Abrar Sayim
Mohammad Asif Abrar Sayim - avatar
+ 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
30th Dec 2017, 8:45 AM
Akash Pal
Akash Pal - avatar
+ 2
+ symbol not allowed that's the question
30th Dec 2017, 8:46 AM
venkatesh
venkatesh - avatar
+ 2
Add two numbers without using plus operator
30th Dec 2017, 8:47 AM
venkatesh
venkatesh - avatar