answersLogoWhite

0


Best Answer

I don't think this can be done. Why do you want to do it without operators, anyway? It is fairly simple to use them. - Of course, you could write a method that adds two numbers, but your method will internally still have to use operators.

-----------------------------------------

Reply by lordstriker24@Yahoo.com

import java.math.BigInteger;

public class MultiplyTest {

public static void main(String[] args) {

BigInteger bigInt1 = new BigInteger("5");

BigInteger bigInt2 = new BigInteger("8");

System.out.println(bigInt1.add(bigInt2));

}

}

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

It is however tricky,you have to use bitwise shift operator

int multiply(int x, int y) {

int m=1, z =0;

while(x>=m && y) {

if (x &m) z=add(y,z);

y <<= 1; m<<= 1;

}

}

return z;

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

The idea is to use repeated addition. You can do this with a "for" loop.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Addition of two numbers without using operators in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you compare 2 numbers without using relational operators in c?

using max function


How do you compare two numbers without using any operators in c?

You cannot compare 2 numbers without using relational operators. Certainly, you could subtract them, but you still need to test the result, and that is a relational operator in itself.


How a program in c that will add 2 numbers without using any operator?

Not possible. Let's not forget than in C the followings are all operators:+, -+=, -=++, --=&, *, []function-call


How do you find the greatest of two numbers without using the if-else comparison operators?

By subtracting any two of the numbers A-B , if the output number is negative , B IS GREAT and if its positive A is great


How do you perform multiplication of two numbers without using the multiplication operator?

By using repeated addition. Consider two numbers a and b. If you want to find a*b then you can add the numbers repeatedly in a loop to get the product. Eg:product = a;for( i=1; i


How do you swap two numbers without using third one using pointers?

How do you do. I am doing well thank you. Swap two number by using reference operators A tough assignment, it will make you think. I think you are confusing reference operators with pointers. Were I you I would study the section on pointers in your text book or course material.


How are Integers combined?

All numbers - integers as well as non-integers - are combined using different mathematical operations. Some operators are binary: that is, they combine two numbers to produce a third; some are ternary (combine 3 to produce a fourth) and so on.The set of integers is closed under some operations: common examples are addition, subtraction, multiplication, exponentiation. But not all operators are: division, for example.


How do you make 380 math?

There are infinitely many ways and these depend on what set of numbers and which operations you are allowed to use. Simple examples, using integers and addition: 1+ 379, 25 + 355 More complicated examples, using multiplication: 760 * 0.5 Using even more specialised operators, 144400^0.5


How do you thirteen digit no without using calculator?

You cannot "do" numbers. You carry out specific operations on numbers and the answer to your question depends on which operator you want. Some operators require another number, such as addition, or subtraction, multiplication, division or exponentiation. Other operations do not: finding the additive inverse, the multiplicative inverse, the square, cube etc, square root, cube root etc, trigonometric or hyperbolic functions, logarithms and so on.


How many of numbers from 1 to 9 can you create using only four 4'S?

All of them, but it does depend on what operators are allowed.


How do you find the greatest of two numbers without using the comparison operators?

void main() { float i,j; int a; printf("Enter two numbers : "); scanf("%f%f",&amp;i&amp;j); a=i/j; if(a) printf("%f is greater",i); else printf("%f is greater",j); }


How would you find wh ether a number is divisible by 9 without using any mathematical operators?

by 4