CCB Premier Import
This commit is contained in:
27
03-SOURCES/Tableaux.java
Normal file
27
03-SOURCES/Tableaux.java
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
public class Tableaux {
|
||||
|
||||
//--------------------------------------------------------
|
||||
public static void main(String[] args) {
|
||||
int tab [] = {1, 2, 3, 4};
|
||||
int nb = 4 ;
|
||||
|
||||
// Afficher avant incr<63>mentation
|
||||
for (int val : tab)
|
||||
System.out.print (val + "\t");
|
||||
|
||||
// Incr<63>menter les cases du tableau
|
||||
incremente (tab, nb, 2);
|
||||
|
||||
// Afficher apr<70>s incr<63>mentation
|
||||
System.out.println();
|
||||
for (int val : tab)
|
||||
System.out.print (val + "\t");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------
|
||||
public static void incremente (int t [], int n, int inc) {
|
||||
for (int i = 0; i < n; i++)
|
||||
t[i] += inc ;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user