How to swap values between two variables without using a
third variable?

Answer Posted / shobha

int x=10,y=20;
x=x+y (10+20=30)
y=x-y (30-20=10)
x=x-y (30-10=20)

x=20,y=10
x and y vales are swaped.

Is This Answer Correct ?    51 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many forms can you create in a Visual Basic 6 Standard EXE project? Is there any limit on that?

1542


without selecting individually each field in Action Class from jsp,what is the best process to select as many as field at a time automatically from jsp page by using value object class.

1440


1. Consider the following input and generate the object code using single pass assembler. JOHN START 0 USING *,15 L 1,FIVE A 1,FOUR ST 1,TEMP FOUR DC F’4’ FIVE DC F’5’ TEMP DS ‘F END

2363


Any real time example of O2C process from taking order till creating invoice.

1791


how to convert the data from HTML file to SAS dataset?

2194






What is WEB 3.0? What are the features their in WEB3.0

1582


could you please tell me how to draw the calibration curve for HPLC {the software which we are using}?

1296


we create a pf with 3 fields.2 is defined as keyfields.we lock it with alcobj command.how we find out whether the file is locked or not?is it dspfd??/

1623


Explain the types of operations? Draw the figure for shift and rotate operations?

2811


What is the use of Differ interface check box in Ship confirm?

1851


what are the advantages of sap on other software ?

1732


what is the extension of SPDS Dynamic cluster tables?

1628


Hai, My name is nisha.I have NIC exam.If anybody Knows NIC previous paper pattern pls send me to nishanairp@gmail.com

1748


What is dialog programming?

1582


purpose of abstraction and interface

1530