By using the + and - operators, we can swap two numbers without using a third variable. Main logic: //Logic…