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

What is private, public and protected inheritance?

675


program explaining feautures of c++

2049


Write a function to perform the substraction of two numbers. Eg: char N1="123", N2="478", N3=-355(N1-N2).

709


Show the declaration for a pointer to function returning long and taking an integer parameter.

666


There are 100 students in a class. The management keep information in two tables. Those two tables are given like Roll no Name Age 001 ABC 15 002 XYZ 14 and Roll No Subject Marks 001 Math 75 001 Physics 55 002 Math 68 001 Hindi 69 They want the information like this Roll No Name Hindi Physics Math Total 001 ABC 69 55 75 199 002 XYZ 68 74 84 226 And Roll No Suject Highest 001 Math 98 007 Physics 84 021 Hindi 74 All 275 All information is kept in structure in main memory. You have to find last two tables.

2619






Mention the purpose of istream class?

702


What are the three forms of cin.get() and what are their differences?

714


What is lambda in c++?

671


Why can templates only be implemented in the header file?

748


What is c++ try block?

668


What is the difference between struct and class?

877


How to allocate memory dynamically for a reference?

623


Write about the various sections of the executable image?

651


What is setbase c++?

725


Describe Trees using C++ with an example.

701