Welcome to Dream.In.Code
Become a Java Expert!

Join 150,133 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 2,185 people online right now. Registration is fast and FREE... Join Now!




adding integers

 
Reply to this topicStart new topic

adding integers

nanda_java
3 Aug, 2008 - 07:19 AM
Post #1

New D.I.C Head
*

Joined: 3 Aug, 2008
Posts: 1

how to add two integers with out using operators
User is offlineProfile CardPM
+Quote Post

Martyr2
RE: Adding Integers
3 Aug, 2008 - 08:10 AM
Post #2

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,660



Thanked: 313 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
Take a look at the "bitwise" operators for such an operation. Then research the following phrase... (a & b ) << 1, a ^ b. That is a bitwise AND, a left shift operator and an XOR operator. Then research using this in a recursive loop. The whole solution is about 4-6 lines in a function which you can call from main.

If you continue to get stuck, show us what you have done so far and we will see what we can do.

smile.gif

This post has been edited by Martyr2: 3 Aug, 2008 - 08:11 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 01:50AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month