how to swap two numbers with out using temp variable
Answer Posted / a.g.dhivyalakshmi
//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
//Thus two numbers are swapped
// or
//a=5 & b=6
a=a*b; //a=30
b=a/b; //b=5
a=a/b; //a=6
//Thus two numbers are swapped
| Is This Answer Correct ? | 8 Yes | 0 No |
Post New Answer View All Answers
If you don’t declare a return value, what type of return value is assumed?
Write a program which employs Recursion
How does a C++ structure differ from a C++ class?
What is the use of namespace std in C++?
Will c++ be replaced?
Why is c++ is better than c?
Is java easier than c++?
What is capacity in vector in c++?
What is the use of function pointer?
Can a function take variable length arguments, if yes, how?
Should a constructor be public or private?
What is input operator in c++?
What does #define mean in c++?
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create
Differentiate between a pointer and a reference with respect to c++.