how to write algorithm and pseudocode and how to draw flowchart swap contents of two variables using third variables

1 answer

Algorithm:

1. Initialize three variables, A, B and C.
2. Assign values to A and B.
3. Print the values of A and B.
4. Assign the value of A to C.
5. Assign the value of B to A.
6. Assign the value of C to B.
7. Print the values of A and B.

Pseudocode:

Declare variables A, B, C
Assign values to A and B
Print A, B
Assign A to C
Assign B to A
Assign C to B
Print A, B

Flowchart:

Start -> Declare A, B, C -> Assign values to A and B -> Print A, B -> Assign A to C -> Assign B to A -> Assign C to B -> Print A, B -> End