GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Tech FAQs  >  Programming  >  Java
Go To First  |  Previous Question  |  Next Question 
 Java  |  Question 841 of 928    Print  
How do you add two numbers using bitwise operators ?

  
Total Answers and Comments: 1 Last Update: June 16, 2008     Asked by: TANUGULA PRADEEP KUMAR 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
June 16, 2008 15:25:42   #1  
leena singhal Member Since: October 2007   Contribution: 1    

RE: How do you add two numbers using bitwise operators ?
we can add 2 numbers using xor operator but it will not handle carry therefore we first use and operator on those 2 numbers n den take a xor of dem ...shift d res of and by 1 bit and den wil xor again the res of shift with d prev xor res....until carry 0

i thnk it will work

 
Is this answer useful? Yes | No

 Related Questions

Find missing numbers in an unsorted sequence of 100 million positive integers with a memory of 64mb ram.
View Question | Asked by : tamilent

Latest Answer : in java.util.Arrays there is some overloaded sort methods. ...
Read Answers (1) | Asked by : nivo

Unary numeric promotion is applied in the following contexts:1.operand of the unary arithmetic operators + and -2.operand of the unary integer bitwise complement operator ~ 3.during array creation; for 
View Question | Asked by : sujatham

Binary numeric promotion is applied in the following contexts:1.operands of the arithmetic operators *, /, %, +, and - 2.operands of the relational operators = 3.operands of the numerical equality operators 
View Question | Asked by : sujatham

nonassosiative. 
View Question | Asked by : sujatham

The shift distance is calculated by AND-ing the value of the right-hand operand with a mask value of 0x1f (31) if the left-hand has the promoted type int, or using a mask value of 0x3f (63) if the left-hand 
View Question | Asked by : sujatham

Latest Answer : we can add 2 numbers using xor operator but it will not handle carry therefore, we first use and operator on those 2 numbers n den take a xor of dem ...shift d res of and by 1 bit and den wil xor again the res of shift with d prev xor res....until ...
Read Answers (1) | Asked by : TANUGULA PRADEEP KUMAR

How to add two numbers without using arithmetic operators? 
Latest Answer : int firstnumber = 1int secondno =2for(int count =0;count


 Sponsored Links

 
Related Articles

Service Oriented Java Business Integration Review

Service Oriented Java Business Integration Review Introduction If you ve read through the texts which give you an introduction to SOA or Web Services you will often find them to be quite frustrating and the reason for this is because they spend too much time referencing business processes which are
 

Concepts of Object-Oriented Programming

Object Oriented JavaScript In this chapter you ll learn about OOP Object Oriented Programming and how it relates to JavaScript As an ASP NET developer you probably have some experience working with objects and you may even be familiar with concepts such as inheritance However unless you re already a
 

C++ Memory Management operators

C Memory Management operators Need for Memory Management operators The concept of arrays has a block of memory reserved The disadvantage with the concept of arrays is that the programmer must know while programming the size of memory to be allocated in addition to the array size remaining constant m
 

C++ Operators Part II

Operators in C Part II In this C tutorial you will learn about logical operators operator operator conditional operator comma operator bitwise operator and sizeof operator mosgoogle center Logical Operators The logical operators used are The operator is called NOT operator This has a single
 

C++ Operators Part I

C Operators Part I In this C tutorial you will learn about operators assignment operator arithmetic operators compound assignment operators increment and decrement operator the functionality of prefix and postfix operators relational and equality operators mosgoogle center The operators available in
 

Java and Client Server Models

Java and Client Server Models The Role of Client Servers on the Web Client server models provide the essential mechanisms for working with the Internet In fact most of the World Wide Web is built according to this paradigm In client server models the web browsers run by millions of users are the cli
 

Precedence of Operators

What is precedence of operators? When number of operators occurs in an expression the operator which is to be evaluated first is judged by applying priority of operators. The arithmetic operators available in C are + used for Addition - used for Subtraction * used for Multiplication / used for D
 

SQL Programming

SQL Programming Overview Anybody who has done something for a long time has probably wanted to change how things work at some point or another. A worker at a mill might have found a more efficient way of cutting logs, or a mathematics teacher might have had a hand in changing a school’s al
 

WinRunner Programming Concepts

If you want to create WinRunner scripts that are highly efficient, there are important programming concepts that you will want to become familiar with. Understanding these concepts will provide you with a large number of key benefits. In addition to understanding these concepts, you must also learn
 

Programming Languages Certification

IT Certification programs have several options that will offer you the best knowledge.  By learning everything that you need to know about information technology you will be able to open new doors to your career and personal business desires.  IT Certification offers several vari
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape