Final answer:
To manipulate the values of i and j using a third variable temp, you can use different operations such as swapping, addition, multiplication, and calculating the average.
Step-by-step explanation:
Given three already declared int variables, i, j, and temp:
- To swap the values of i and j, you can assign the value of i to temp, then assign the value of j to i, and finally assign the value of temp to j. This will swap their values.
- To add the values of i and j and store the result in temp, you can simply use the addition operator: temp = i + j.
- To multiply the values of i and j and store the result in temp, you can use the multiplication operator: temp = i * j.
- To initialize temp to the average of i and j, you can calculate the average by adding i and j and dividing by 2: temp = (i + j) / 2.