master
Minkra 2023-10-23 17:17:42 +02:00
parent 49498f5465
commit 1223c34950
3 changed files with 66 additions and 15 deletions

View File

@ -133,18 +133,35 @@ public class Anfang
{
summe = summe +arr[i];
}
System.out.println(summe);
System.out.println("Die Summe aller Zahlen im Array ist " + summe);
double min = 1;
double max = 0;
System.out.println(min);
System.out.println(max);
}
double bisMax = arr[0];
for(int i=0; i<arr.length; i++)
{
if (arr[i] > bisMax)
{
bisMax = arr[i];
}
}
System.out.println("Die größste Zahl des Arrays ist " + bisMax);
double bisMin = arr[0];
for(int i=0; i<arr.length; i++)
{
if (arr[i] < bisMax)
{
bisMin = arr[i];
}
}
System.out.println("Die kleinste Zahl des Arrays ist " + bisMin);
}
}

41
Minimumsuche.java Normal file
View File

@ -0,0 +1,41 @@
import java.util.Random;
public class Minimumsuche
{
public static void Minimumsuche()
{
Random r = new Random();
int[] a = next int[20];
for (int i= 0; i< arr.length; i++)
{
a[i] = r.nextInt(50);
}
for (int i = 0; i < arr.length; i++)
{
System.out.print(a[i]);
System.out.print(",");
}
}
public static int Minimum(int [] a)
{
System.out.println();
int min = 99;
int minindex = i;
for(int i = 0; i < arr.length; i++)
{
if (a[i] < min)
{
min = a[I];
minindex = i;
}
}
return minindex;
}
}
}

View File

@ -1,7 +0,0 @@
public class __SHELL40 extends bluej.runtime.Shell {
public static void run() throws Throwable {
Anfang.Aufgabe2();
}}