without using arthematic operation ,how can you write the
logic for adding/substraction/multiplication?
Answers were Sorted based on User's Feedback
Answer / sumalatha
By using bitwise operators, we can implement addition,
subtraction and multiplication operations.
| Is This Answer Correct ? | 6 Yes | 1 No |
Answer / madhusmita pal
using logical operator AND(^)OR(||)and XOR(-).
| Is This Answer Correct ? | 7 Yes | 3 No |
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 |
Answer / xxx
ok without using arthematic operation? give a google search.
am also searching for that.
| Is This Answer Correct ? | 1 Yes | 1 No |
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 |
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 |
How do I convert a numeric ip address like 192.18.97.39 into a hostname like java.sun.com?
List some important features of java 10 release?
What is garbage collection? What is the process that is responsible for doing that in java?
Where is the find and replace?
Features of JAVA ? In which version of java synchronizedXXX() methods are included in Collections class.
what is the difference between statis block and static variable
What is public static void main?
What is a copy constructor in java?
How can you read content from file in java?
What is lambda in java?
What is array command?
What error occurs if a try-catch-finally statement sequence does not have a catch clause?