Answer:
The algorithm is as follows
- Start
- Accept Input1 and Input2
- Input1 = Input1 + Input2
- Input2= Input1- Input2
- Input1= Input1- Input2
- Print Input1
- Print Input2
- Stop
See attachment for Flowchart
Line 1 and 8 of the algorithm starts and stops the algorithm
Line 2 accepts the two integer variables (input1 and input2)
Take for instance input1 = 5 and input2 = 4
Line 3 increases input1 by input2
At this point, Input1 = 5 + 4 = 9
Line 4 subtracts input2 from input1 and saves it in input2
i.e. Input2 = 9 - 4 = 5
Note that, the value of input2 has changed to the initial value of Input1
Line 5 subtracts input2 from input1 and saves it in input1
i.e. Input1 = 9 - 5 = 4
Note that, the value of input1 has changed to the initial value of Input2
Line 6 and 7 prints the new values of input1 and input2
The flowchart does the same thing as the algorithm; the only difference is that it uses lines and shapes to depict flow of program
The flowchart was designed using Microsoft Office Word