write a program to swap Two numbers without using temp variable.

Answer Posted / anantha

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

if a=3 and b=5
then now b=a+b=8
and a=8-a=8-3=5,now a=5
b=8-a=8-5=3,now b=3

so, a=5 and b=3

Is This Answer Correct ?    198 Yes 59 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this

2914


How do you define a string?

641


Can we change the value of static variable in c?

550


Tell me can the size of an array be declared at runtime?

585


Can the curly brackets { } be used to enclose a single line of code?

703






How many levels of indirection in pointers can you have in a single declaration?

581


How can I get back to the interactive keyboard if stdin is redirected?

657


When should a type cast not be used?

613


What is a wrapper function in c?

570


What are the different categories of functions in c?

631


If i have an array 0 to 99 i.e,(Size 100) I place the values 1 to 100 randomly like a[0]=29,a[1]=56 upto array[99].. the values are only between 1 to 100. getting the array values by using scanf.. If i entered one wrong element value line a[56]=108. how can i find it.. and also how to find the missing value in 1 to 100.. and i want to replace the missing values.. any one of them know please post your answer..

1576


What does s c mean in text?

597


What the different types of arrays in c?

604


What are the similarities between c and c++?

585


What is main function in c?

535