package tag4;

public class Zaehlen {

    public static void zaehleBisZahlUndRufe(int zahl) {

        for (int temp = 1; temp <= zahl; temp++) {
            System.out.println(temp);
        }

        /*
        int temp = 1;

        while (temp <= zahl) {
            System.out.println(temp);
            temp++;
        }
        */
        System.out.println("Ich komme!");

    }

    public static int fakultaet(int zaehler) {
        //0! = 1
        //5! = 5 * 4 * 3 * 2 * 1

        int ergebnis = 1;

        while (zaehler >= 1 ) {
            ergebnis = ergebnis * zaehler; // ergebnis *= zaehler;
            zaehler--;
        }

        return ergebnis;
    }

    public static void ausgabeOhneNull() {
        //gibt 50...1 aus
        for (int i = 50; i > 0; i--) {
                System.out.println(i);
        }

        //gibt -1...-100 aus
        for (int i = -1; i >= -100; i--) {
            System.out.println(i);

        }
    }

    public static void main(String[] args) {
        //zaehleBisZahlUndRufe(5);
        //System.out.println(fakultaet(5));
        ausgabeOhneNull();
    }
}
