Question about Microsoft Windows XP Professional

1 Answer

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

Posted by on

1 Answer

  • 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
  • 50 Answers

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>
int add(int a, int b){
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);
printf("Sum is: %d",add(a,b));
}

Posted on Mar 06, 2009

1 Suggested Answer

6ya6ya
  • 2 Answers

SOURCE: I have freestanding Series 8 dishwasher. Lately during the filling cycle water hammer is occurring. How can this be resolved

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).
click here to download the app (for users in the US for now) and get all the help you need.
goodluck!

Posted on Jan 02, 2017

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

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

1 Answer

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

1 Answer

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

2 Answers

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

3 Answers

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

1 Answer

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

1 Answer

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

1 Answer

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...

1 Answer

Samsung d900i


Create contact (Menu 2.3)
Use this menu to add a new contact to Phonebook.
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.
Mobile/Home/Office/Fax/Other: add a
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.
Email: assign an e-mail address.


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.
Notes: add a memo about the person.
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.
Phone number: add a number.
Location: assign a location number.
4. Press <Save> or [ ] to save the contact.

Mar 05, 2008 | Samsung SGH-D900 Cellular Phone

Not finding what you are looking for?
Microsoft Windows XP Professional Logo

Related Topics:

257 people viewed this question

Ask a Question

Usually answered in minutes!

Top Microsoft Computers & Internet Experts

micky dee

Level 3 Expert

2635 Answers

Les Dickinson
Les Dickinson

Level 3 Expert

18333 Answers

Brian Sullivan
Brian Sullivan

Level 3 Expert

27725 Answers

Are you a Microsoft Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...