how to swap two numbers with out using temp variable

Answer Posted / pranav

//swaping of 2 numbers without using temp variable
//a=5 & b=6
a=a+b; //a=30
b=a-b; //b=5
a=a-b; //a=6

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Snake Game: This is normal snake game which you can find in most of the mobiles. You can develop it in Java, C/C++, C# or what ever language you know.

2761


Explain the volatile and mutable keywords.

819


What are the various situations where a copy constructor is invoked?

825


Which bit wise operator is suitable for putting on a particular bit in a number?

934


what is pre-processor in C++?

801


C is to C++ as 1 is to a) What the heck b) 2 c) 10

827


Name four predefined macros.

805


Write a function to find the nth item from the end of a linked list in a single pass.

742


What are activex and ole?

771


How is c++ different from java?

773


Explain one-definition rule (odr).

859


Is c better than c++?

831


What is an adaptor class or wrapper class in c++?

800


What is implicit pointer in c++?

797


What is a dynamic binding in c++?

704