SWAP THE TWO VARIABLE VALUES WITHOUT TAKING THIRD VARIABLE?

Nigel Bunyan

Total Post:4

Points:20
Posted by  Nigel Bunyan
 747  View(s)
Ratings:
Rate this:
  1. Nigel Bunyan

    Post:4

    Points:20
    Swap the two variable values without taking third variable?

    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);

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!