Sobes.tech
Junior — Senior

Swapping values of two variables without auxiliary resources

livecode

Task condition

It is necessary to write a function that swaps the values of variables a and b without using additional variables, objects, or language structures. The function should work directly with the passed parameters and not return a result.

public class JetbulbInterview {
    public static void main(String[] args) {
        // Example: swapIntegers(10, 20)
        // After execution:
        // a = 20;
        // b = 10;
    }

    static void swapIntegers(int a, int b) {
        // Implement value swapping
    }
}