From d028638080355c7e13c8c3a11954218c09691349 Mon Sep 17 00:00:00 2001 From: Jessica Luisa Wiedl Date: Mon, 23 Oct 2023 10:56:29 +0200 Subject: [PATCH] Array.java aktualisiert Maximus und Minimum eines Arrays ausgeben --- Array.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Array.java b/Array.java index 7b1d362..d7783a6 100644 --- a/Array.java +++ b/Array.java @@ -32,7 +32,22 @@ public class Array { System.out.print(min = arr[i]); } - //? + /** + max = items[0]; + min = items[0]; + + for (int i = 1; i < items.length; i++) { + if (items[i] > max) { + max = items[i]; + } + else if (items[i] < min) { + min = items[i]; + } + } + + System.out.println(max); //100 + System.out.println(min); //0 + **/ } } }