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

1 answer

1. Declare three variables: var1, var2, and temp.
2. Assign values to var1 and var2.
3. Store the value of var1 in temp.
4. Assign the value of var2 to var1.
5. Assign the value of temp to var2.
6. The contents of var1 and var2 are now swapped.

Here's the pseudocode:

```
declare var1, var2, temp as integers

var1 = 5
var2 = 10

temp = var1
var1 = var2
var2 = temp

// Now var1 contains 10 and var2 contains 5
```