From e94a5c5242c720a7eae0e31e8d2306fa5d28b852 Mon Sep 17 00:00:00 2001 From: hummel Date: Fri, 14 Jun 2024 12:04:52 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20Erm=C3=B6gliche=20die=20Addition=20mehr?= =?UTF-8?q?erer=20Ganzzahlen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../de/hs_mannheim/informatik/gitdemo/Main.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/GitBestPractices/src/de/hs_mannheim/informatik/gitdemo/Main.java b/GitBestPractices/src/de/hs_mannheim/informatik/gitdemo/Main.java index b00d497..ed2c1fb 100644 --- a/GitBestPractices/src/de/hs_mannheim/informatik/gitdemo/Main.java +++ b/GitBestPractices/src/de/hs_mannheim/informatik/gitdemo/Main.java @@ -4,6 +4,21 @@ public class Main { public static void main(String[] args) { System.out.println("Hallo Welt!"); + + Main m = new Main(); + + System.out.println(); + System.out.printf("Die Summe von %d + % d = %d", 3, 8, m.add(3, 8)); + System.out.printf("Es geht noch besser: %d + %d + %d = %d", 2, 5, 9, m.add(2, 5, 9)); + } + + public int add(int... numbers) { + int res = 0; + + for (int n : numbers) + res += n; + + return res; } -} +} \ No newline at end of file