wat are the two methods for swapping two numbers without
using temp variable??

Answers were Sorted based on User's Feedback



wat are the two methods for swapping two numbers without using temp variable??..

Answer / shrikantauti

i dont know the methods but can give the code to swap values without temporary variable.
a b
a=a+b
b=a-b
a=a-b

Is This Answer Correct ?    6 Yes 0 No

wat are the two methods for swapping two numbers without using temp variable??..

Answer / abhishek karnani

int a=10,b=5;

a=a+b-(b=a);

Is This Answer Correct ?    4 Yes 0 No

Post New Answer

More C Interview Questions

what is a far pointer

12 Answers   ABB, DRDO, ITI, Maruti Suzuki, Steel Plant, TCS, Toyota, Vivo Mobiles,


can please someone teach me how to create this program using while statement.. this is the output should look like 0 2 4 6 8 10 -thanks.. :) need it asap...

7 Answers  


write a program fibonacci series and palindrome program in c

0 Answers   Aditi Placement Service,


there is two conditions , 1. while using for loop for printing 1 to 50 no's simulteneous 2. while using printf functios for printing 1 to 50 no's simulteneous with or without using variables who will take more time for compiling and execution? explain in details with reason?

1 Answers  


consagous technology placement paper

3 Answers   Consagous, Sypra,


Explain the red-black trees?

0 Answers  


What is define c?

0 Answers  


an algorithem for the implementation of circular doubly linked list

1 Answers  


5. distance conversion: Convert a distance from miles to kilometers .there are 5280 feets per mile,12 inches per foot .2.54 centimeters per inch and 100000centimeters per kilometer

4 Answers  


Write a program to reverse a given number in c language?

0 Answers  


What is the difference between CV and Resume ?

2 Answers  


how to return 1000 variables from functio9n in c?plz give me code also

6 Answers  


Categories