how to swap two numbers with out using temp variable

Answers were Sorted based on User's Feedback



how to swap two numbers with out using temp variable..

Answer / dd

a=1
b=2
a=a+(b-a)
b=(a+b)-b

Is This Answer Correct ?    12 Yes 16 No

how to swap two numbers with out using temp variable..

Answer / kusum

if (a>b)
temp=a;
a=b;
b=temp;

Is This Answer Correct ?    0 Yes 21 No

Post New Answer

More C++ General Interview Questions

What is the difference between public and private data members?

1 Answers  


What is the difference between "overloading" and "overridding"?

3 Answers  


When is a template a better solution than a base class?

1 Answers  


What are the advantages of C++ programming compared to C programming?

2 Answers   HAL,


What is the difference between global int and static int declaration?

1 Answers  


What is the iunknown interface?

1 Answers  


What is a list c++?

1 Answers  


write a C++ programming using for loop: * * * * * * * * * *

4 Answers   TCS,


How do I use turbo c++?

1 Answers  


Explain working of printf?

8 Answers  


Describe exception handling concept with an example?

1 Answers  


What is c++ w3school?

1 Answers  


Categories