how to swap the variables without using temp and operators



how to swap the variables without using temp and operators..

Answer / santhosh

int a, b;
a = 10;
b = 20;
a = a + b;
//a=30
b = a - b;
a = a - b;

Console.WriteLine("a={0},b={1}", a, b);
Console.ReadLine();

Is This Answer Correct ?    10 Yes 2 No

Post New Answer

More OOPS Interview Questions

What is ambiguity in c++

4 Answers   Accenture, Mphasis,


What is namespace?

15 Answers  


write knight tour problem which is present in datastructure

0 Answers  


What is encapsulation process?

0 Answers  


Where is pseudocode used?

0 Answers  






What is the oops and benefits of oops programming?

0 Answers  


Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)

0 Answers   HCL,


Write a program to compute for numeric grades for a course. The course records are in a file that will serve as the input file. The input file is in exactly the following format: Each line contains a student's first name, then one space, then ten quiz scores all on one line. The quiz scores are in whole number and are separated by one space. Your program will take it input from this file and sends it output to a second file. The data in the output file will be exactly the same as the data in the input file except that there will be one additional number (of type double) at the end of each line. This number will be the average of the student's ten quiz scores. Use at least one function that has file streams as all or some of its arguments.

0 Answers  


can you give real time example for polymarphism

5 Answers   TCS,


what is abstract class ? when is used in real time ? give a exp

5 Answers  


How to overload new operator in c++

2 Answers  


What does <> mean pseudocode?

0 Answers  


Categories