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

for(;;) printf("C language") What is out put of above??

2 Answers   Practical Viva Questions,


what is the different between if-else and switch statment (other than syntax)

26 Answers   CTS, Oracle, Scorpos,


Why we use void main in c?

1 Answers  


#define MAX(x,y) (x) >(y)?(x):(y) main() { inti=10,j=5,k=0; k= MAX(i++,++j); printf("%d..%d..%d",i,j,k); }

1 Answers   Wilco,


What is string in c language?

1 Answers  


main() { FILE *fs; char c[10]; fs = fopen(“source.txt”, ”r”); /* source.txt exists and contains “Vector Institute” */ fseek(fs,0,SEEK_END); fseek(fs,-3L,SEEK_CUR); fgets(c,5,fs); puts(c); }

1 Answers   Vector,


in programming languages a statement or part of a statement that specifies several different execution sequences a) constructs b) distructs c) executes d) none

1 Answers  


When should you use a type cast?

1 Answers  


What is hashing in c?

1 Answers  


How to print "Hi World" without using semi colon?

6 Answers   Infosys,


What is the difference between union and anonymous union?

0 Answers   Hexaware,


what are the interview question's in the language c

2 Answers   Nipuna,


Categories