how to swap all the values without using temporary variable.
tha values r a = 20, x=60 and p=2.

Answer Posted / gurusaran

x=x*a; (x=1200)
a=x/a; (a=60)
x=x/a; (x=20)

p=p*x; (p=40)
x=p/x; (x=2)
p=p/x; (p=20)

Hence final values are a=60,x=2,p=20

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to know we are in home page of a web application using QTP

2004


5.Call by value and Call by reference with program?

1836


In project we have Documentation phase also,in that what is micro and macro designing?

1426


how to stop execution of step 3 in a job mainframe

1717


It is possible to take number of controls added to form at run-time.ex-when user enter 6, 6 text boxes get added to form,next time number of controls get change as per user number enter. What is code for that?

1513






how to get second highest salary from a employee table and how get a 5th highest salary from a employee table by using proc sql?

1900


i want to insert textbox value to sql db. i have only one text box but store four values. ple give any one give sample code in asp.net c#..

2890


I am taking the bmc control m/enterprise manager 7.0 scheduling test and just wanted to see what kind of questions they would ask or if anyone has taken the test and how long it is for how many questions?

5668


How to set on/off a group of indicators in a single statement?

1381


Write a shell program. Enter number of days from keyboard. Find out the number of years, month and days it contains

1526


5. How do you round the addition or subtraction of two numbers in assembler?

1778


How to call a C++ function which is compiled with C++ compiler in C code?

796


How to call dll API sub routine in VB Form.

1913


why we use abstract in awt?

1562


how many types of bytes are there???

1991