<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://socialledge.com/sjsu/index.php?action=history&amp;feed=atom&amp;title=Add_without_using_any_arithmetic_operators</id>
		<title>Add without using any arithmetic operators - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://socialledge.com/sjsu/index.php?action=history&amp;feed=atom&amp;title=Add_without_using_any_arithmetic_operators"/>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=Add_without_using_any_arithmetic_operators&amp;action=history"/>
		<updated>2026-04-10T21:24:35Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.27.1</generator>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=Add_without_using_any_arithmetic_operators&amp;diff=30450&amp;oldid=prev</id>
		<title>Proj user16: Created page with &quot;== Interview Question : Add without using any arithmetic operators == '''''Approach:''''' What choice do we have if not to use any operators for addition? '''''Bits!!''''' &lt;br...&quot;</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=Add_without_using_any_arithmetic_operators&amp;diff=30450&amp;oldid=prev"/>
				<updated>2016-12-13T04:25:08Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Interview Question : Add without using any arithmetic operators == &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Approach:&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; What choice do we have if not to use any operators for addition? &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Bits!!&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; &amp;lt;br...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Interview Question : Add without using any arithmetic operators ==&lt;br /&gt;
'''''Approach:''''' What choice do we have if not to use any operators for addition? '''''Bits!!'''''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
1) XOR the two numbers to perform addition without any carry.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
2) AND them and left shift to perform a carry without any further addition.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
3) Recurse until there is nothing left to carry.&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
int addNoOperator (int x, int y)&lt;br /&gt;
{&lt;br /&gt;
	if (y==0) return x;  // Base case&lt;br /&gt;
	int add = x ^ y; // add without any carry&lt;br /&gt;
	int carry = (x &amp;amp; y) &amp;lt;&amp;lt; 1; // carry, but no addition&lt;br /&gt;
	return addNoOperator (add, carry); // recurse with add + carry&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Proj user16</name></author>	</entry>

	</feed>