Home > DeveloperSection > Interviews > Swap the two variable values without taking third variable?

Posted on    September-01-2015 12:12 AM

 iPhone iPhone  Ios  Objective C 
Ratings:
 1 Answer(s)
  492  View(s)
Rate this:

Nigel Bunyan
Nigel Bunyan

Total Post:4

Points:20
Posted on    September-01-2015 12:12 AM

int x=10;

int y=5;

x=x+y;

NSLog(@x==> %d,x);

 

y=x-y;

NSLog(@Y Value==> %d,y);

 

x=x-y;

NSLog(@x Value==> %d,x);


Don't want to miss updates? Please click the below button!

Follow MindStick