1.

Circulate the contents:Write the specification and construct an algorithm to circulate the contents of the variables A, B and C as shown below: The arrows indicate that B gets the value of A, C gets the value of B and A gets the value of C.

Answer»

Specifications:

1. circulate 

2. – – inputs: a, b, c: = A, B, C

3. – – outputs: a, b, c: = C, A, B

Algorithm:

1. circulate (a, b, c)

2. – – a, b, c: = A, B, C 

3. temp : = c

4. c : = b

5. b : = a

6. a : = temp

7. – – a, b, c: = C, A, B



Discussion

No Comment Found