Write a Program to calculate Sum of Two number Without Using Any operator like +,-,* ... etc.

similarly here you have to implement full adder . But not only for 3 bit make it general . i.e it can add any number .

To do this you can use recursion or looping .

Here we provide you C & Python 3 program sample .

####

Have a Nice Day 8-)

**You can solve it in many different ways : But you need to consider binary operation like XOR , AND .****Imagine if you have to add two number in Binary what will you do . simply you going to create full adder .**

similarly here you have to implement full adder . But not only for 3 bit make it general . i.e it can add any number .

To do this you can use recursion or looping .

Here we provide you C & Python 3 program sample .

#### C code Without Recursion :

```
#include<stdio.h>
int Add(int x, int y)
{
while (y != 0)
```**// Iterate till there is no carry **
{
int carry = x & y;
** // carry now contains common set bits of x and y**
x = x ^ y;
** // Sum of bits of x and y where at least one of the bits is not set**
y = carry << 1;
* // Carry is shifted by one so that adding it to x gives the required sum*
}
return x;
}
int main()
{
int a,b;
printf("input a & b : ");
scanf("%d %d",&a,&b);
printf("%d", Add(a, b));
return 0;
}

#### C code With Recursion :

```
#include<stdio.h>
int Add(int x, int y)
```** ****//Recursive problem **
{
if (y == 0)
return x;
else
return Add( x ^ y, (x & y) << 1);
}
int main()
{
int a,b;
printf("input a & b : ");
scanf("%d %d",&a,&b);
printf("%d", Add(a, b));
return 0;
}

**# Python 3 code without recursion :**

`def ADD(x,y): while(y!=0): carry=x&y x=x^y y=carry<<1 return(x) x=int(input("insert first no : ")) y=int(input("insert second no : ")) print(ADD(x,y))`

####
**# Python 3 code with recursion :**

```
def ADD(x,y):
if(y==0):
return(x)
else:
return(ADD(x^y,(x&y)<<1))
x=int(input("insert first no : "))
y=int(input("insert second no : "))
print(ADD(x,y))
```

Hope It will Help you :::)### Test your Programming Skill : P-2

Have a Nice Day 8-)

Hello there! I could have sworn I've visited this website before

ReplyDeletebut after looking at some of the articles I realized

it's new to me. Nonetheless, I'm certainly happy I came across it and

I'll be book-marking it and checking back often!

Here is my weblog; Christian Louboutin Sydney

I’m not that much of a online reader to

ReplyDeletebe honest but your blogs really nice, keep it up! I'll go ahead and bookmark your site to come back later on. All

the best

Also visit my page: Louis Vuitton Online

Hey! I'm at work browsing your blog from my new iphone! Just wanted

ReplyDeleteto say I love reading through your blog and look forward to all your posts!

Carry on the excellent work!

Check out my site; Louboutin Shoes

It's wonderful that you are getting thoughts from this piece of writing as well as from our discussion made at this place.

ReplyDeleteReview my homepage :: Christian Louboutin Boots

Hey great blog! Does running a blog like this take a lot of work?

ReplyDeleteI've absolutely no expertise in coding however I was hoping to start my own blog soon. Anyways,

should you have any suggestions or tips for new blog owners please share.

I know this is off subject however I just had to ask. Kudos!

My web blog - Discount Christian Louboutin

I’m not that much of a internet reader to be honest but your sites really nice,

ReplyDeletekeep it up! I'll go ahead and bookmark your website to come back

later. All the best

Here is my blog - Christian Louboutin Heels