
public class SchleifeRekursiv {

	public static void main(String[] args) {
		print1toN(1);
		print1toN(4);
		print1toN(5);
		print1toN(8);

		printNto1(1);
		printNto1(4);
		printNto1(5);
		printNto1(8);
	}

	private static void printNto1(int i) {
		System.out.print(i + " ");
		if (i == 1) {
			System.out.println();
			return;
		}
		printNto1(i - 1);
	}

	private static void print1toN(int n) {
		print1toNImpl(1, n);
		System.out.println();
	}

	private static void print1toNImpl(int i, int n) {
		System.out.print(i + " ");
		if (i == n)
			return;
		print1toNImpl(i + 1, n);
	}

}
