/**
 * @author Jean-Baptiste Yunès
 * @date Janvier 2013
 */
public class Cours2 {
    static public int uneVariable;
    public static int somme(int n) {
        int somme = 0;
        for (int i=0; i<n; i++) {
            somme += i;
        }
        return somme;
    }
    public static void main(String []args) {
        uneVariable = 100;
        for (int i=0; i<10; i++) {
            System.out.println("coucou");
        }
        System.out.println("Resultat = " + somme(10));
        System.out.println("Resultat = " + somme(100));
        int []tableau;
        tableau = new int[50];
        System.out.println(tableau.length);
        System.out.println(tableau);
        System.out.println(tableau[11]);

        int [][]t2d;
        t2d = new int[3][4];
        System.out.println(t2d);
        System.out.println(t2d.length);
        System.out.println(t2d[1]);
        System.out.println(t2d[1].length);
        System.out.println(t2d[1][2]);

        int []t1 = new int[2];
        int []t0 = new int[3];
        int []t2 = new int[4];
        int [][]t = new int[3][];
        t[0] = t0;
        t[1] = t1;
        t[2] = t2;

        System.out.println(t[2][1]);
        t2[1] = 666;
        System.out.println(t[2][1]);
        System.out.println(t2[1]);

        int unEntier = 10;
        System.out.println(successeur(unEntier));
        System.out.println(successeur(unEntier+3));

        int a, b, c;
        a = 666;
        b = 999;
        System.out.println("a="+a+" b="+b);
        c = b;
        b = a;
        a = c;
        System.out.println("a="+a+" b="+b);
        echange(a,b);
        System.out.println("a="+a+" b="+b);
    }
    static void echange(int a,int b) {
        int tmp;
        tmp = b;
        b = a;
        a = tmp;
    }
    static int successeur(int i) {
        i = i+1;
        return i;
    }
}