Inversion variables, tableau

This commit is contained in:
Meutel 2019-05-30 21:38:31 +02:00
parent dbd88e5af7
commit 298af8b3b9
2 changed files with 86 additions and 0 deletions

58
InvTab.java Normal file
View File

@ -0,0 +1,58 @@
import static utils.Utils.*;
public class InvTab {
public static final void main(String[] args) {
afficher("Inversion tableau");
int[] tab = { 34, 568, 11, 678, 0};
afficherTabInt(tab);
int[] tab2 = new int[tab.length];
for(int compteur=0; compteur<tab.length; compteur++){
int element = tab[compteur];
int compteur2 = tab.length-compteur-1;
tab2[compteur2] = element;
}
afficherTabInt(tab2);
}
}

28
InvVars.java Normal file
View File

@ -0,0 +1,28 @@
import static utils.Utils.*;
public class InvVars {
public static final void main(String[] args) {
afficher("Inversion");
int a= 5;
int b= 1;
afficher("a = ",a);
afficher("b = ",b);
int c=a;
a=b;
b=c;
afficher("a = ",a);
afficher("b = ",b);
}
}