Question d’entretien chez Maruti Suzuki

Swap two numbers without using third variable

Réponse à la question d'entretien

Utilisateur anonyme

11 sept. 2024

// Let the two numbers be a and b a = a + b; // Step 1: Add both numbers b = a - b; // Step 2: Subtract b from the sum to get a a = a - b; // Step 3: Subtract the new b from the sum to get b