From 7881c5b11fdef5899113cb20ea2364c754317b39 Mon Sep 17 00:00:00 2001 From: DH10RBH Date: Mon, 15 Apr 2024 13:52:51 +0200 Subject: [PATCH] v1 --- .../Kontrollstrukturen afg2/src/Main.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Kontrollstrukturen/Kontrollstrukturen afg2/src/Main.java b/Kontrollstrukturen/Kontrollstrukturen afg2/src/Main.java index eb1160c..48ac1b1 100644 --- a/Kontrollstrukturen/Kontrollstrukturen afg2/src/Main.java +++ b/Kontrollstrukturen/Kontrollstrukturen afg2/src/Main.java @@ -8,12 +8,33 @@ public class Main { n = 20; - for (int i = anfang; i < 21; i++) { + for (int i = anfang; i <= n; i++) { speicher += i; System.out.println(speicher); } + + /* anfang = 1; + while (anfang <= n) { + + speicher += anfang; + System.out.println(speicher); + + anfang++; + } */ + + /* anfang = 1; + do { + + speicher += anfang; + System.out.println(speicher); + + anfang++; + + } while (anfang <= n); */ + + } } \ No newline at end of file