You are given a task to write a program to switch values between variables, but you are not allowed to use any extra variable or any function to exchange values between the other variables as shown below:
int a,b,c,d;
a=A;
b=B;
c=C;
d=D;
.......//only fill this part.
Write(a+" "+b+" "+c+" "+d);
---------------------------- Output -----------------------------
C D B A
while $a,b,c$ and $d$ are integer variable, $A$,$B$,$C$ and $D$ are some random integer values. Your task is to exchange values between these variables without using any extra variable or any function but just fill the blank part with the least amount of lines
putting all operations next to each other as a line is invalid line means
a=a+b+c; a=a/b/c*d;
is two lines, not one line.
Note: You are not even supposed to be programmer to solve this.
Note 2: I forgot to change the value of $b$ since it was intended and for simplicity I have change the letters.
a=b+c+d;
permitted? $\endgroup$a = C; b = D; c = B; d = A
. $\endgroup$(a,b,c,d)=(c,d,b,a)
$\endgroup$