A computer has three registers, A, B and R. It has only three instructions:
A->R : Load R with A
B->R : Load R with B
A-R->A : Subtract R from A and store the result in A
Using these instructions how can you do the follwoing?
B->A : Load A with B
solution:-
A->R
// R == AA-R->A
// A == 0B->R
// R == BA-R->A
// A == -BA->R
// R == -BA-R->A
// A == 0A-R->A
// A == B
0 comments: