diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-04-12 12:24:05 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2023-04-12 12:24:05 +0200 |
| commit | 67224ec1889dd7d481e1069e4bcb40bb52f41c7c (patch) | |
| tree | 64187aa93ab4f296edf0cdd8f01bb91339bd185e /Info/Rekursion/Rekursion.java | |
| parent | 1f9beb9004cd558b9070d06f9c717a3dc931c5f5 (diff) | |
| download | unterricht-67224ec1889dd7d481e1069e4bcb40bb52f41c7c.tar.gz unterricht-67224ec1889dd7d481e1069e4bcb40bb52f41c7c.zip | |
add simple but complex recursion example
Diffstat (limited to 'Info/Rekursion/Rekursion.java')
| -rw-r--r-- | Info/Rekursion/Rekursion.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Info/Rekursion/Rekursion.java b/Info/Rekursion/Rekursion.java new file mode 100644 index 00000000..cbc1d6b5 --- /dev/null +++ b/Info/Rekursion/Rekursion.java @@ -0,0 +1,13 @@ +class Rekursion { + public static void main(String argv[]) { + get(0); + } + + public static void get(int x) { + if (x == 6) + System.out.println("Code:"); + if (x < 6) + get(x+=2); + System.out.println(x); + } +} |
