without using arthematic operation ,how can you write the
logic for adding/substraction/multiplication?




Answers were Sorted based on User's Feedback



without using arthematic operation ,how can you write the logic for adding/substraction/multiplica..

Answer / sumalatha

By using bitwise operators, we can implement addition,
subtraction and multiplication operations.

Is This Answer Correct ?    6 Yes 1 No

without using arthematic operation ,how can you write the logic for adding/substraction/multiplica..

Answer / madhusmita pal

using logical operator AND(^)OR(||)and XOR(-).

Is This Answer Correct ?    7 Yes 3 No

without using arthematic operation ,how can you write the logic for adding/substraction/multiplica..

Answer / sankar

Without using arthematic operation adding two numbers:

#include<stdio.h>
int main()
{
int a=5,b=6;
while(b)
{
a=a^b;
b=(a^b)&b;
b=b<<1;
}
printf("The sum of a and b is: %d\n",a);
return 0;
}

Is This Answer Correct ?    1 Yes 0 No




without using arthematic operation ,how can you write the logic for adding/substraction/multiplica..

Answer / xxx

ok without using arthematic operation? give a google search.
am also searching for that.

Is This Answer Correct ?    1 Yes 1 No

without using arthematic operation ,how can you write the logic for adding/substraction/multiplica..

Answer / upendra

plz send the answer for this quary

Is This Answer Correct ?    0 Yes 1 No

without using arthematic operation ,how can you write the logic for adding/substraction/multiplica..

Answer / ashwinkumar

int a = 10;
int b = 5;
int sum = BigInteger.valueOf(a).add(BigInteger.valueOf(b)).intValue();
int sum1 = BigInteger.valueOf(a).subtract(BigInteger.valueOf(b)).intValue();
int sum2 = BigInteger.valueOf(a).multiply(BigInteger.valueOf(b)).intValue();

Is This Answer Correct ?    2 Yes 3 No

without using arthematic operation ,how can you write the logic for adding/substraction/multiplica..

Answer / raaaj

visit nataraz.blogspot.com for the answer.you will get a lot of tricky question in future

Is This Answer Correct ?    0 Yes 1 No

Post New Answer



More Core Java Interview Questions

why we need this (1.object,2.class,3.data hiding,4.encapsulation,5.abstraction,6. polymorphism,7.inheritance)

2 Answers  


What is the protocol is used in type4 driver?

4 Answers   CMC,


What is serializable interface?

13 Answers   Infosys, Seed Infotech, Probity Soft,


What is the root class for all Java classes?

8 Answers   IBM, Infosys,


what are the different non-access specifiers in java?

5 Answers  






When does Exception occurs?

3 Answers  


Why we should declare the variables as static and final in interfaces?

1 Answers  


Can we add default constructor to Servlet?

1 Answers   Fidelity,


when there is a need of jvm then how we can say that java is a platform independent language?

3 Answers  


How OOPS concept is achieved in Java?

6 Answers   Cognizant, JPMorgan Chase, Xavient,


what is difference between signed & unsigned char?

2 Answers  


Linked List reverese program

2 Answers   Bally Technologies,






Categories