Question about Microsoft Windows XP Professional

# How to add two no in c without any operator (even assignment operator)?

Posted by on

• Level 2:

An expert who has achieved level 2 by getting 100 points

MVP:

An expert that gotĀ 5 achievements.

Sniper:

An expert who has posted more than 50 answers, of which 90% or more were rated as helpful.

Governor:

An expert whose answer gotĀ voted for 20 times.

• Expert

This code doesn't include any overflow error checking mechanism. It is not much difficult to implement one however.
#include <stdio.h>
int main(){
unsigned num1,num2,result=0,i=0,temp=0;
printf("Enter the two numbers:\n");
scanf("%d",&num1);
scanf("%d",&num2);
for (i= ~0; i; i>>= 1){ //ensure that the body of the loop is executed 8*sizeof(unsigned) times where 8 is the number of bits in a byte. The number of bits in a byte can be more than 8 on some machines.
temp<<= 1;
temp|= (num1^num2^result)&1;
result= ((num1|num2)&result|num1&num2)&1;//to understand this line and the one above take a look at the full adder circuit above
//here temp is the equivalent of S1 in the full adder circuit above and result is the equivalent of C1
num1>>= 1;
num2>>= 1;
}
//the bit order in temp would be in the reverse order. the following code snippet reverses the order
for (i= ~0, result= ~i; i; i>>= 1){
result<<= 1;
result|= temp&1;
temp>>= 1;
}
printf("Sum: %d",result);
return 0;
}

Here is another elegant solution that uses recursion
#include <stdio.h>
if (!a) return b;
else
return add((a & b) << 1, a ^ b);
}
int main(){
printf("Enter the two numbers: \n");
int a,b;
scanf("%d",&a);
scanf("%d",&b);
}

Posted on Mar 06, 2009

Hi,
a 6ya expert can help you resolve that issue over the phone in a minute or two.
best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.
the service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).
goodluck!

Posted on Jan 02, 2017

×

my-video-file.mp4

×

## Related Questions:

### By Default Panasonic - 824 CO1, CO2, CO3 are working. now i add 2nd card How can i assign CO4, CO5, CO6?

Lines are assigned in program 400. Normally, they are assigned by default so someone had to work very hard to unnasign them even though you didn't have the hardware.

Apr 01, 2013 | Panasonic KX-TA824PK Phone

### Can't get windows xp home edition to recognize wireless printer, even after assigning printer TCP/IP address. Windows 7 computer prints to it, but the Windows XP computer can't even find the...

Hi!

You din't wrote what's the model of your printer, but I think we can find a solution:
1. Try to ping the IP adress you assigned to the printer. If that works, please download the latest drivers or installation software from the manufacturer of your printer (or second option use the installation disk that came with your printer). If it does not reply to ping, be sure the IP adress you assigned to the printer is in same range as the IP adresses on your network.
2. It is possible that the installation software itself manage to find the printer on the network, and that means the problem is solved
3. If not, install the printer as it is local attached (e.g USB or LPT port)
4. After installing as local printer, please go to printer proprieties, go to port, choose add a new port, choose standard tcp/ip port and write for the port the IP adress you assigned to the printer.
5. Apply changes and ...that's it.

Please let me know if it helped,

Good luck!

Aug 10, 2011 | Microsoft Windows XP Home Edition

### How can i assign a ip address to canon ir3025 in windows

open printer properties of some printer and select PORT, go on ADD PORT, and create IP port, then assign it to Canon Ir 3025. Be sure that the same IP, Subnet and gateway are on PC and copier. Under cmd run ping comand, eg. ping 192.168.1.100, and if you have replay without 100 % loss it would be OK.

Jun 14, 2010 | Ricoh Aficio 3025 All-In-One Laser Printer

### I have the AT&T Model 854 4-line phone. When the phone is plugged in the phone starts toning and won't stop.

Thats because its looking for the intercom number to be assigned. as soon as you assign one in programming it will stop.

Apr 29, 2010 | AT&T ATT-974 Corded Phone

### Can't explore pendrive[vista ultimate]

ive got no idea wat a pen drive is but if you open the start menu, right click on computer select properties there should now be a window open, on the left of that window there should be some options one of them is device manager, open it and the device (pendrive) will be there with a yellow symbol next to it click on it and it will give you more info and a repair option, hope this helps if you have more trouble get back to me

Jun 23, 2009 | Microsoft Windows Vista Ultimate Edition

### Limited or no connectivity. No assign network Add. to comp.

Have you checked the cable?
Try this with a new cable installed:
Go to Start menu > Run > type "cmd" (without the quotes) and hit Enter or click OK.
In the black DOS-window type "ipconfig/release" (without the quotes) and press Enter.
Type "ipconfig/renew" (without the quotes)
and press Enter.
When the DOS windows displays an IP-number (e.g 192.168.1.2), close the DOS-window and try to connect.
Alternatively right click the network-connection icon down on the far right beside the clock and choose "Repair"
Good luck!
;)

Apr 25, 2009 | Computers & Internet

### Xp home & wireless printer won't install

Add the printer in a TCP/IP port and assign it that IP address. /Add Printer/local connection then set it to TCP/IP port and the printers ip address.

Jan 15, 2009 | Microsoft Windows XP Home Edition

### Dhcp in server 2003 in domain not working

Windows 2003 server supports DHCP. If you don't see in Administrative tool DHCP maybe the DHCP role is not enabled. You can add this role in "Manage your server". You don't need to reinstall win 2003 server.
Another way to access DHCP management tool is: in command prompt type mmc and then File> "Add remove snap-in" then "Add" and select DHCP.

Jan 06, 2009 | Microsoft Windows Server Standard 2003 for...

### Samsung d900i

Storing a number in the phone’s memory
1. Select Phone.
2. Change the settings or enter information about the
contact:
First name/Last name: assign a name.
number in any category.
You can change the number type, or set the
number as the default for the contact by
pressing <Options> and selecting Change
type
or Mark as default number.

Graphic ID: assign a caller ID image to alert
you to a call from the person.

Ringtone: assign a ringtone to alert you to a
call from the person.
Group: assign the number to a caller group.
Birthday: enter the person’s birthday.
3. Press <Save> or [ ] to save the contact.
Storing a number on the SIM card
1. Select SIM.
2. Select New or Update.
3. Enter information about the contact:
Name: assign a name.
Location: assign a location number.
4. Press <Save> or [ ] to save the contact.

Mar 05, 2008 | Samsung SGH-D900 Cellular Phone

## Open Questions:

#### Related Topics:

257 people viewed this question

Level 3 Expert

Level 3 Expert