Hi All,
I am new to programming and want to know how can i write a
code to take input of 2 numbers from user and swap it
without using a temp variable?

Answers were Sorted based on User's Feedback



Hi All, I am new to programming and want to know how can i write a code to take input of 2 numbers..

Answer / x

a=a+b;
b=a-b;
a=a-b;

Is This Answer Correct ?    3 Yes 1 No

Hi All, I am new to programming and want to know how can i write a code to take input of 2 numbers..

Answer / gopi

a=A+b;
b=a-b;
a=a-b;

Is This Answer Correct ?    4 Yes 3 No

Post New Answer

More OOPS Interview Questions

What are the 3 pillars of oop?

0 Answers  


Where You Can Use Interface in your Project

0 Answers   KPIT,


Write a program to find out the number of palindromes in a sentence.

1 Answers   TCS,


what is object slicing

3 Answers   TCS,


What's the full form of STL?

2 Answers  






i hav very low percentage in 12th n BSCwhich is around 50.......coz it was just imposed on me 2 b a science graduate,nw m doin MCA n hav aggregate 74% ....what shud i answer if company's HR ask me about dis much low previous percentage??????

3 Answers   Infosys,


#include <iostream> using namespace std; int main() { int a = 2; int c[5][5]; for (int x=0;x<5;x++) { for (int y=0;y<5;y++) { c[x][y] = x*y; } } cout << c[a][c[1][4]]; }

2 Answers   TCS, Wipro,


what is the difference between inter class and abstract class...?

0 Answers  


Why do we use polymorphism?

0 Answers  


In which cases you use override and new base?

2 Answers  


why in java first invoke public static void main(String args[]) method????Why not public static void method1(String args[])??

1 Answers  


what is different between oops and c++

0 Answers   IIT,


Categories