| [Précédent] |
| 2.14 |
Variable, affectation - Corrigé | Niveau 2 |
||
Fichiers: |
Permutation.java | |||
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import java.util.Scanner;
class Permutation {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Entrez x: ");
int x = scanner.nextInt();
System.out.print("Entrez y: ");
int y = scanner.nextInt();
System.out.println("Avant permutation: ");
System.out.println("x : " + x);
System.out.println("y : " + y);
int tmp = x;
x = y;
y = tmp;
System.out.println("Après permutation: ");
System.out.println("x : " + x);
System.out.println("y : " + y);
scanner.close();
}
} |
| [Précédent] |