how to flowchart of swap the contents of two variable using a third variable

1 answer

1. Start the flowchart process.
2. Define and initialize the variables a,b, and temp to store the two variables whose contents need to be swapped and a third variable to hold temporarily the contents of one of the variables.
3. Display the values of variables a and b before swapping.
4. Assign the value of variable a to the temporary variable temp.
5. Assign the value of variable b to variable a.
6. Assign the value of temp to variable b.
7. Display the values of variables a and b after swapping.
8. Stop the flowchart process.

Here is the flowchart diagram:

```
START

Input a and b

Display "Before Swapping:"
Display a and b

Set temp = a
Set a = b
Set b = temp

Display "After Swapping:"
Display a and b

STOP
```