Question d’entretien chez Colgate-Palmolive

How do you swap two integer variables without creating a temporary variable?

Réponses aux questions d'entretien

Utilisateur anonyme

23 sept. 2017

int x = 10; int y = 12; x = x+y //x = 22, y = 12 y = x - y //x = 22, y = 10 x = x-y // x= 12, y=10

1

Utilisateur anonyme

1 févr. 2019

In python: a, b = b, a