G 
		
				
			
		Guest
Gast
Ja leute, hat einer eine Idee?
			
			tfa hat gesagt.:Wo ist das Problem?
:shock:didjitalist hat gesagt.:Die mittlere von drei Zahlen ist die an der dritten Stelle, oder?
int[] f = new int[]{100, 50, 13, 1, 9};
int m = -1;
		
int sum1 = Math.abs(f[0] - f[1]) + Math.abs(f[0] - f[2]) + Math.abs(f[0] - f[3]) + Math.abs(f[0] - f[4]);
int sum2 = Math.abs(f[1] - f[0]) + Math.abs(f[1] - f[2]) + Math.abs(f[1] - f[3]) + Math.abs(f[1] - f[4]);
int sum3 = Math.abs(f[2] - f[0]) + Math.abs(f[2] - f[1]) + Math.abs(f[2] - f[3]) + Math.abs(f[2] - f[4]);
int sum4 = Math.abs(f[3] - f[0]) + Math.abs(f[3] - f[1]) + Math.abs(f[3] - f[2]) + Math.abs(f[3] - f[4]);
int sum5 = Math.abs(f[4] - f[0]) + Math.abs(f[4] - f[1]) + Math.abs(f[4] - f[2]) + Math.abs(f[4] - f[3]);
		
if ((sum1 <= sum2) && (sum1 <= sum3) && (sum1 <= sum4) && (sum1 <= sum5)) m = 0;
else if ((sum2 <= sum1) && (sum2 <= sum3) && (sum2 <= sum4) && (sum2 <= sum5)) m = 1;
else if ((sum3 <= sum1) && (sum3 <= sum2) && (sum3 <= sum4) && (sum3 <= sum5)) m = 2;
else if ((sum4 <= sum1) && (sum4 <= sum2) && (sum4 <= sum3) && (sum4 <= sum5)) m = 3;
else if ((sum5 <= sum1) && (sum5 <= sum2) && (sum5 <= sum3) && (sum5 <= sum4)) m = 4;
				
System.out.println(f[m]);((f[0] - f[1]) < 0)?(-1)*(f[0]-f[1]):(f[0]-f[1])    private static void mittel(int a, int b, int c, int d, int e) {
        int h;
        if (a>b) { h=a; a=b; b=h; }
        if (b>c) { h=b; b=c; c=h; }
        if (c>d) { h=c; c=d; d=h; }
        if (d>e) { h=d; d=e; e=h; }
        if (a>b) { h=a; a=b; b=h; }
        if (b>c) { h=b; b=c; c=h; }
        if (c>d) { h=c; c=d; d=h; }
        if (a>b) { h=a; a=b; b=h; }
        if (b>c) { h=b; b=c; c=h; }
        if (a>b) { h=a; a=b; b=h; }
        System.out.println(c);
    }int[] f = new int[] {100, 50, 13, 1, 9};
int m = 0;
int sum = 0;
int sum1 = Math.abs(f[0] - f[1]) + Math.abs(f[0] - f[2]) + Math.abs(f[0] - f[3]) + Math.abs(f[0] - f[4]);
sum = sum1;
int sum2 = Math.abs(f[1] - f[0]) + Math.abs(f[1] - f[2]) + Math.abs(f[1] - f[3]) + Math.abs(f[1] - f[4]);
if (sum2 < sum) { m = 1; sum = sum2; }
int sum3 = Math.abs(f[2] - f[0]) + Math.abs(f[2] - f[1]) + Math.abs(f[2] - f[3]) + Math.abs(f[2] - f[4]);
if (sum3 < sum) { m = 2; sum = sum3; }
int sum4 = Math.abs(f[3] - f[0]) + Math.abs(f[3] - f[1]) + Math.abs(f[3] - f[2]) + Math.abs(f[3] - f[4]);
if (sum4 < sum) { m = 3; sum = sum4; }
int sum5 = Math.abs(f[4] - f[0]) + Math.abs(f[4] - f[1]) + Math.abs(f[4] - f[2]) + Math.abs(f[4] - f[3]);
if (sum5 < sum) { m = 4; }
System.out.println(f[m]);int[] f = new int[] { 50, 200, 9, 100, 1 };
		if (((((f[0] - f[1]) < 0 ? (-1) * (f[0] - f[1]) : f[0] - f[1])
				+ ((f[0] - f[2]) < 0 ? (-1) * (f[0] - f[2]) : f[0] - f[2])
				+ ((f[0] - f[3]) < 0 ? (-1) * (f[0] - f[3]) : f[0] - f[3]) + ((f[0] - f[4]) < 0 ? (-1)
				* (f[0] - f[4])
				: f[0] - f[4])) <= (((f[1] - f[0]) < 0 ? (-1) * (f[1] - f[0])
				: f[1] - f[0])
				+ ((f[1] - f[2]) < 0 ? (-1) * (f[1] - f[2]) : f[1] - f[2])
				+ ((f[1] - f[3]) < 0 ? (-1) * (f[1] - f[3]) : f[1] - f[3]) + ((f[1] - f[4]) < 0 ? (-1)
				* (f[1] - f[4])
				: f[1] - f[4])))
				&& ((((f[0] - f[1]) < 0 ? (-1) * (f[0] - f[1]) : f[0] - f[1])
						+ ((f[0] - f[2]) < 0 ? (-1) * (f[0] - f[2]) : f[0]
								- f[2])
						+ ((f[0] - f[3]) < 0 ? (-1) * (f[0] - f[3]) : f[0]
								- f[3]) + ((f[0] - f[4]) < 0 ? (-1)
						* (f[0] - f[4]) : f[0] - f[4])) <= (((f[2] - f[0]) < 0 ? (-1)
						* (f[2] - f[0])
						: f[2] - f[0])
						+ ((f[2] - f[1]) < 0 ? (-1) * (f[2] - f[1]) : f[2]
								- f[1])
						+ ((f[2] - f[3]) < 0 ? (-1) * (f[2] - f[3]) : f[2]
								- f[3]) + ((f[2] - f[4]) < 0 ? (-1)
						* (f[2] - f[4]) : f[2] - f[4])))
				&& ((((f[0] - f[1]) < 0 ? (-1) * (f[0] - f[1]) : f[0] - f[1])
						+ ((f[0] - f[2]) < 0 ? (-1) * (f[0] - f[2]) : f[0]
								- f[2])
						+ ((f[0] - f[3]) < 0 ? (-1) * (f[0] - f[3]) : f[0]
								- f[3]) + ((f[0] - f[4]) < 0 ? (-1)
						* (f[0] - f[4]) : f[0] - f[4])) <= (((f[3] - f[0]) < 0 ? (-1)
						* (f[3] - f[0])
						: f[3] - f[0])
						+ ((f[3] - f[1]) < 0 ? (-1) * (f[3] - f[1]) : f[3]
								- f[1])
						+ ((f[3] - f[2]) < 0 ? (-1) * (f[3] - f[2]) : f[3]
								- f[2]) + ((f[3] - f[4]) < 0 ? (-1)
						* (f[3] - f[4]) : f[3] - f[4])))
				&& ((((f[0] - f[1]) < 0 ? (-1) * (f[0] - f[1]) : f[0] - f[1])
						+ ((f[0] - f[2]) < 0 ? (-1) * (f[0] - f[2]) : f[0]
								- f[2])
						+ ((f[0] - f[3]) < 0 ? (-1) * (f[0] - f[3]) : f[0]
								- f[3]) + ((f[0] - f[4]) < 0 ? (-1)
						* (f[0] - f[4]) : f[0] - f[4])) <= (((f[4] - f[0]) < 0 ? (-1)
						* (f[4] - f[0])
						: f[4] - f[0])
						+ ((f[4] - f[1]) < 0 ? (-1) * (f[4] - f[1]) : f[4]
								- f[1])
						+ ((f[4] - f[2]) < 0 ? (-1) * (f[4] - f[2]) : f[4]
								- f[2]) + ((f[4] - f[3]) < 0 ? (-1)
						* (f[4] - f[3]) : f[4] - f[3]))))
			System.out.println(f[0]);
		else if (((((f[1] - f[0]) < 0 ? (-1) * (f[1] - f[0]) : f[1] - f[0])
				+ ((f[1] - f[2]) < 0 ? (-1) * (f[1] - f[2]) : f[1] - f[2])
				+ ((f[1] - f[3]) < 0 ? (-1) * (f[1] - f[3]) : f[1] - f[3]) + ((f[1] - f[4]) < 0 ? (-1)
				* (f[1] - f[4])
				: f[1] - f[4])) <= (((f[0] - f[1]) < 0 ? (-1) * (f[0] - f[1])
				: f[0] - f[1])
				+ ((f[0] - f[2]) < 0 ? (-1) * (f[0] - f[2]) : f[0] - f[2])
				+ ((f[0] - f[3]) < 0 ? (-1) * (f[0] - f[3]) : f[0] - f[3]) + ((f[0] - f[4]) < 0 ? (-1)
				* (f[0] - f[4])
				: f[0] - f[4])))
				&& ((((f[1] - f[0]) < 0 ? (-1) * (f[1] - f[0]) : f[1] - f[0])
						+ ((f[1] - f[2]) < 0 ? (-1) * (f[1] - f[2]) : f[1]
								- f[2])
						+ ((f[1] - f[3]) < 0 ? (-1) * (f[1] - f[3]) : f[1]
								- f[3]) + ((f[1] - f[4]) < 0 ? (-1)
						* (f[1] - f[4]) : f[1] - f[4])) <= (((f[2] - f[0]) < 0 ? (-1)
						* (f[2] - f[0])
						: f[2] - f[0])
						+ ((f[2] - f[1]) < 0 ? (-1) * (f[2] - f[1]) : f[2]
								- f[1])
						+ ((f[2] - f[3]) < 0 ? (-1) * (f[2] - f[3]) : f[2]
								- f[3]) + ((f[2] - f[4]) < 0 ? (-1)
						* (f[2] - f[4]) : f[2] - f[4])))
				&& ((((f[1] - f[0]) < 0 ? (-1) * (f[1] - f[0]) : f[1] - f[0])
						+ ((f[1] - f[2]) < 0 ? (-1) * (f[1] - f[2]) : f[1]
								- f[2])
						+ ((f[1] - f[3]) < 0 ? (-1) * (f[1] - f[3]) : f[1]
								- f[3]) + ((f[1] - f[4]) < 0 ? (-1)
						* (f[1] - f[4]) : f[1] - f[4])) <= (((f[3] - f[0]) < 0 ? (-1)
						* (f[3] - f[0])
						: f[3] - f[0])
						+ ((f[3] - f[1]) < 0 ? (-1) * (f[3] - f[1]) : f[3]
								- f[1])
						+ ((f[3] - f[2]) < 0 ? (-1) * (f[3] - f[2]) : f[3]
								- f[2]) + ((f[3] - f[4]) < 0 ? (-1)
						* (f[3] - f[4]) : f[3] - f[4])))
				&& ((((f[1] - f[0]) < 0 ? (-1) * (f[1] - f[0]) : f[1] - f[0])
						+ ((f[1] - f[2]) < 0 ? (-1) * (f[1] - f[2]) : f[1]
								- f[2])
						+ ((f[1] - f[3]) < 0 ? (-1) * (f[1] - f[3]) : f[1]
								- f[3]) + ((f[1] - f[4]) < 0 ? (-1)
						* (f[1] - f[4]) : f[1] - f[4])) <= (((f[4] - f[0]) < 0 ? (-1)
						* (f[4] - f[0])
						: f[4] - f[0])
						+ ((f[4] - f[1]) < 0 ? (-1) * (f[4] - f[1]) : f[4]
								- f[1])
						+ ((f[4] - f[2]) < 0 ? (-1) * (f[4] - f[2]) : f[4]
								- f[2]) + ((f[4] - f[3]) < 0 ? (-1)
						* (f[4] - f[3]) : f[4] - f[3]))))
			System.out.println(f[1]);
		else if (((((f[2] - f[0]) < 0 ? (-1) * (f[2] - f[0]) : f[2] - f[0])
				+ ((f[2] - f[1]) < 0 ? (-1) * (f[2] - f[1]) : f[2] - f[1])
				+ ((f[2] - f[3]) < 0 ? (-1) * (f[2] - f[3]) : f[2] - f[3]) + ((f[2] - f[4]) < 0 ? (-1)
				* (f[2] - f[4])
				: f[2] - f[4])) <= (((f[0] - f[1]) < 0 ? (-1) * (f[0] - f[1])
				: f[0] - f[1])
				+ ((f[0] - f[2]) < 0 ? (-1) * (f[0] - f[2]) : f[0] - f[2])
				+ ((f[0] - f[3]) < 0 ? (-1) * (f[0] - f[3]) : f[0] - f[3]) + ((f[0] - f[4]) < 0 ? (-1)
				* (f[0] - f[4])
				: f[0] - f[4])))
				&& ((((f[2] - f[0]) < 0 ? (-1) * (f[2] - f[0]) : f[2] - f[0])
						+ ((f[2] - f[1]) < 0 ? (-1) * (f[2] - f[1]) : f[2]
								- f[1])
						+ ((f[2] - f[3]) < 0 ? (-1) * (f[2] - f[3]) : f[2]
								- f[3]) + ((f[2] - f[4]) < 0 ? (-1)
						* (f[2] - f[4]) : f[2] - f[4])) <= (((f[1] - f[0]) < 0 ? (-1)
						* (f[1] - f[0])
						: f[1] - f[0])
						+ ((f[1] - f[2]) < 0 ? (-1) * (f[1] - f[2]) : f[1]
								- f[2])
						+ ((f[1] - f[3]) < 0 ? (-1) * (f[1] - f[3]) : f[1]
								- f[3]) + ((f[1] - f[4]) < 0 ? (-1)
						* (f[1] - f[4]) : f[1] - f[4])))
				&& ((((f[2] - f[0]) < 0 ? (-1) * (f[2] - f[0]) : f[2] - f[0])
						+ ((f[2] - f[1]) < 0 ? (-1) * (f[2] - f[1]) : f[2]
								- f[1])
						+ ((f[2] - f[3]) < 0 ? (-1) * (f[2] - f[3]) : f[2]
								- f[3]) + ((f[2] - f[4]) < 0 ? (-1)
						* (f[2] - f[4]) : f[2] - f[4])) <= (((f[3] - f[0]) < 0 ? (-1)
						* (f[3] - f[0])
						: f[3] - f[0])
						+ ((f[3] - f[1]) < 0 ? (-1) * (f[3] - f[1]) : f[3]
								- f[1])
						+ ((f[3] - f[2]) < 0 ? (-1) * (f[3] - f[2]) : f[3]
								- f[2]) + ((f[3] - f[4]) < 0 ? (-1)
						* (f[3] - f[4]) : f[3] - f[4])))
				&& ((((f[2] - f[0]) < 0 ? (-1) * (f[2] - f[0]) : f[2] - f[0])
						+ ((f[2] - f[1]) < 0 ? (-1) * (f[2] - f[1]) : f[2]
								- f[1])
						+ ((f[2] - f[3]) < 0 ? (-1) * (f[2] - f[3]) : f[2]
								- f[3]) + ((f[2] - f[4]) < 0 ? (-1)
						* (f[2] - f[4]) : f[2] - f[4])) <= (((f[4] - f[0]) < 0 ? (-1)
						* (f[4] - f[0])
						: f[4] - f[0])
						+ ((f[4] - f[1]) < 0 ? (-1) * (f[4] - f[1]) : f[4]
								- f[1])
						+ ((f[4] - f[2]) < 0 ? (-1) * (f[4] - f[2]) : f[4]
								- f[2]) + ((f[4] - f[3]) < 0 ? (-1)
						* (f[4] - f[3]) : f[4] - f[3]))))
			System.out.println(f[2]);
		else if (((((f[3] - f[0]) < 0 ? (-1) * (f[3] - f[0]) : f[3] - f[0])
				+ ((f[3] - f[1]) < 0 ? (-1) * (f[3] - f[1]) : f[3] - f[1])
				+ ((f[3] - f[2]) < 0 ? (-1) * (f[3] - f[2]) : f[3] - f[2]) + ((f[3] - f[4]) < 0 ? (-1)
				* (f[3] - f[4])
				: f[3] - f[4])) <= (((f[0] - f[1]) < 0 ? (-1) * (f[0] - f[1])
				: f[0] - f[1])
				+ ((f[0] - f[2]) < 0 ? (-1) * (f[0] - f[2]) : f[0] - f[2])
				+ ((f[0] - f[3]) < 0 ? (-1) * (f[0] - f[3]) : f[0] - f[3]) + ((f[0] - f[4]) < 0 ? (-1)
				* (f[0] - f[4])
				: f[0] - f[4])))
				&& ((((f[3] - f[0]) < 0 ? (-1) * (f[3] - f[0]) : f[3] - f[0])
						+ ((f[3] - f[1]) < 0 ? (-1) * (f[3] - f[1]) : f[3]
								- f[1])
						+ ((f[3] - f[2]) < 0 ? (-1) * (f[3] - f[2]) : f[3]
								- f[2]) + ((f[3] - f[4]) < 0 ? (-1)
						* (f[3] - f[4]) : f[3] - f[4])) <= (((f[1] - f[0]) < 0 ? (-1)
						* (f[1] - f[0])
						: f[1] - f[0])
						+ ((f[1] - f[2]) < 0 ? (-1) * (f[1] - f[2]) : f[1]
								- f[2])
						+ ((f[1] - f[3]) < 0 ? (-1) * (f[1] - f[3]) : f[1]
								- f[3]) + ((f[1] - f[4]) < 0 ? (-1)
						* (f[1] - f[4]) : f[1] - f[4])))
				&& ((((f[3] - f[0]) < 0 ? (-1) * (f[3] - f[0]) : f[3] - f[0])
						+ ((f[3] - f[1]) < 0 ? (-1) * (f[3] - f[1]) : f[3]
								- f[1])
						+ ((f[3] - f[2]) < 0 ? (-1) * (f[3] - f[2]) : f[3]
								- f[2]) + ((f[3] - f[4]) < 0 ? (-1)
						* (f[3] - f[4]) : f[3] - f[4])) <= (((f[2] - f[0]) < 0 ? (-1)
						* (f[2] - f[0])
						: f[2] - f[0])
						+ ((f[2] - f[1]) < 0 ? (-1) * (f[2] - f[1]) : f[2]
								- f[1])
						+ ((f[2] - f[3]) < 0 ? (-1) * (f[2] - f[3]) : f[2]
								- f[3]) + ((f[2] - f[4]) < 0 ? (-1)
						* (f[2] - f[4]) : f[2] - f[4])))
				&& ((((f[3] - f[0]) < 0 ? (-1) * (f[3] - f[0]) : f[3] - f[0])
						+ ((f[3] - f[1]) < 0 ? (-1) * (f[3] - f[1]) : f[3]
								- f[1])
						+ ((f[3] - f[2]) < 0 ? (-1) * (f[3] - f[2]) : f[3]
								- f[2]) + ((f[3] - f[4]) < 0 ? (-1)
						* (f[3] - f[4]) : f[3] - f[4])) <= (((f[4] - f[0]) < 0 ? (-1)
						* (f[4] - f[0])
						: f[4] - f[0])
						+ ((f[4] - f[1]) < 0 ? (-1) * (f[4] - f[1]) : f[4]
								- f[1])
						+ ((f[4] - f[2]) < 0 ? (-1) * (f[4] - f[2]) : f[4]
								- f[2]) + ((f[4] - f[3]) < 0 ? (-1)
						* (f[4] - f[3]) : f[4] - f[3]))))
			System.out.println(f[3]);
		else if (((((f[4] - f[0]) < 0 ? (-1) * (f[4] - f[0]) : f[4] - f[0])
				+ ((f[4] - f[1]) < 0 ? (-1) * (f[4] - f[1]) : f[4] - f[1])
				+ ((f[4] - f[2]) < 0 ? (-1) * (f[4] - f[2]) : f[4] - f[2]) + ((f[4] - f[3]) < 0 ? (-1)
				* (f[4] - f[3])
				: f[4] - f[3])) <= (((f[0] - f[1]) < 0 ? (-1) * (f[0] - f[1])
				: f[0] - f[1])
				+ ((f[0] - f[2]) < 0 ? (-1) * (f[0] - f[2]) : f[0] - f[2])
				+ ((f[0] - f[3]) < 0 ? (-1) * (f[0] - f[3]) : f[0] - f[3]) + ((f[0] - f[4]) < 0 ? (-1)
				* (f[0] - f[4])
				: f[0] - f[4])))
				&& ((((f[4] - f[0]) < 0 ? (-1) * (f[4] - f[0]) : f[4] - f[0])
						+ ((f[4] - f[1]) < 0 ? (-1) * (f[4] - f[1]) : f[4]
								- f[1])
						+ ((f[4] - f[2]) < 0 ? (-1) * (f[4] - f[2]) : f[4]
								- f[2]) + ((f[4] - f[3]) < 0 ? (-1)
						* (f[4] - f[3]) : f[4] - f[3])) <= (((f[1] - f[0]) < 0 ? (-1)
						* (f[1] - f[0])
						: f[1] - f[0])
						+ ((f[1] - f[2]) < 0 ? (-1) * (f[1] - f[2]) : f[1]
								- f[2])
						+ ((f[1] - f[3]) < 0 ? (-1) * (f[1] - f[3]) : f[1]
								- f[3]) + ((f[1] - f[4]) < 0 ? (-1)
						* (f[1] - f[4]) : f[1] - f[4])))
				&& ((((f[4] - f[0]) < 0 ? (-1) * (f[4] - f[0]) : f[4] - f[0])
						+ ((f[4] - f[1]) < 0 ? (-1) * (f[4] - f[1]) : f[4]
								- f[1])
						+ ((f[4] - f[2]) < 0 ? (-1) * (f[4] - f[2]) : f[4]
								- f[2]) + ((f[4] - f[3]) < 0 ? (-1)
						* (f[4] - f[3]) : f[4] - f[3])) <= (((f[2] - f[0]) < 0 ? (-1)
						* (f[2] - f[0])
						: f[2] - f[0])
						+ ((f[2] - f[1]) < 0 ? (-1) * (f[2] - f[1]) : f[2]
								- f[1])
						+ ((f[2] - f[3]) < 0 ? (-1) * (f[2] - f[3]) : f[2]
								- f[3]) + ((f[2] - f[4]) < 0 ? (-1)
						* (f[2] - f[4]) : f[2] - f[4])))
				&& ((((f[4] - f[0]) < 0 ? (-1) * (f[4] - f[0]) : f[4] - f[0])
						+ ((f[4] - f[1]) < 0 ? (-1) * (f[4] - f[1]) : f[4]
								- f[1])
						+ ((f[4] - f[2]) < 0 ? (-1) * (f[4] - f[2]) : f[4]
								- f[2]) + ((f[4] - f[3]) < 0 ? (-1)
						* (f[4] - f[3]) : f[4] - f[3])) <= (((f[3] - f[0]) < 0 ? (-1)
						* (f[3] - f[0])
						: f[3] - f[0])
						+ ((f[3] - f[1]) < 0 ? (-1) * (f[3] - f[1]) : f[3]
								- f[1])
						+ ((f[3] - f[2]) < 0 ? (-1) * (f[3] - f[2]) : f[3]
								- f[2]) + ((f[3] - f[4]) < 0 ? (-1)
						* (f[3] - f[4]) : f[3] - f[4])))) System.out.println(f[4]);;public class Test {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
      int a=0;
      int b=55;
      int c=3;
      int d=7;     
      int e=6;
      
      
    	if(isMitte(a,b,c,d,e)) System.out.println("a ist Mitte");
    	if(isMitte(b,a,c,d,e)) System.out.println("b ist Mitte");
    	if(isMitte(c,b,a,d,e)) System.out.println("c ist Mitte");
    	if(isMitte(d,c,b,a,e)) System.out.println("d ist Mitte");
    	if(isMitte(e,d,c,b,a)) System.out.println("e ist Mitte");
	}
	
	public static boolean isMitte(int a, int b,int c, int d, int e)
	{
		 if(((a>b && a>c) && (a<d && a<e)) || 
	    		    ((a>b && a>d) && (a<c && a<e)) || 
	    		    ((a>b && a>e) && (a<c && a<d)) || 
	    		    ((a>c && a>d) && (a<b && a<e)) || 
	    		    ((a>c && a>e) && (a<b && a<d)) || 
	    		    ((a>d && a>e) && (a<b && a<c)))
			 return true;
		 else
			 return false;
		           
	}
}public class Test
{
    public static void main(String[] args)
    {
        int a = 0;
        int b = 55;
        int c = 3;
        int d = 7;
        int e = 6;
        if (isMitte(a, b, c, d, e)) System.out.println("a ist Mitte");
        if (isMitte(b, a, c, d, e)) System.out.println("b ist Mitte");
        if (isMitte(c, b, a, d, e)) System.out.println("c ist Mitte");
        if (isMitte(d, c, b, a, e)) System.out.println("d ist Mitte");
        if (isMitte(e, d, c, b, a)) System.out.println("e ist Mitte");
    }
    public static boolean isMitte(int a, int b, int c, int d, int e)
    {
        int count = 0;
        count += Math.signum(a - b);
        count += Math.signum(a - c);
        count += Math.signum(a - d);
        count += Math.signum(a - e);
        return count == 0;
    }
}Hier gehts nicht um isMitte, sondern um findMitte!
Da Du Dich letzten Endes nur für das c interessierst, kannst Du das letzte if auch weglassen, da es c ja nicht verändern kann.tfa hat gesagt.:if (a>b) { h=a; a=b; b=h; }
System.out.println(c);
public static int mittel(int a, int b, int c, int d, int e)
{ 
    int h;
    // Phase 1
    if (a>b) { h=a; a=b; b=h; } 
    if (b>c) { h=b; b=c; c=h; } 
    if (c>d) { h=c; c=d; d=h; } 
    if (d>e) d=e; 
    if (a>b) { h=a; a=b; b=h; } 
    if (b>c) { h=b; b=c; c=h; } 
    if (c>d) c=d; 
    // Phase 2
    if (a>b) b=a; 
    if (b>c) c=b; 
    return c;
}Saxony hat gesagt.:Lustig sieht es erst aus, wenn man komplett auf Zuweisungen und Math.abs verzichtet.
Code:...
Aber naja!
bye Saxony
Leroy42 hat gesagt.:Deine Menge an Freizeit möchte ich auch mal haben. :shock:
    static int mittel(int a,int b,int c,int d,int e){return x(a,b,c,d,e,3);}
    static int y(int a, int b, int c, int d, int e, int n){return x(a,b<c?b:c,b<c?c:b,d<e?d:e,d<e?e:d,n-1);}
    static int x(int a, int b, int c, int d, int e, int n){return n==0?c:y(a<b?a:b,a<b?b:a,c<d?c:d,c<d?d:c,e,n);}    static int mittel(int a,int b,int c,int d,int e){return u(a,b,c,d,e);}
    static int u(int a, int b, int c, int d, int e){return v(a<b?a:b, a<b?b:a, c<d?c:d, c<d?d:c, e);}
    static int v(int a, int b, int c, int d, int e){return w(a, b<c?b:c, b<c?c:b, d<e?d:e, d<e?e:d);}
    static int w(int a, int b, int c, int d, int e){return x(a<b?a:b, a<b?b:a, c<d?c:d, c<d?d:c, e);}
    static int x(int a, int b, int c, int d, int e){return y(a, b<c?b:c, b<c?c:b, d<e?d:e, d<e?e:d);}
    static int y(int a, int b, int c, int d, int e){return z(a<b?a:b, a<b?b:a, c<d?c:d, c<d?d:c, e);}
    static int z(int a, int b, int c, int d, int e){return c; }static int mittel(int a,int b,int c,int d,int e){return(((a<b?a:b)<((a<b?b:a)<(c
<d?c:d)?(a<b?b:a):(c<d?c:d))?((a<b?b:a)<(c<d?c:d)?(a<b?b:a):(c<d?c:d)):(a<b?a:b)
)<(((a<b?b:a)<(c<d?c:d)?(c<d?c:d):(a<b?b:a))<((c<d?d:c)<e?(c<d?d:c):e)?((a<b?b:a
)<(c<d?c:d)?(c<d?c:d):(a<b?b:a)):((c<d?d:c)<e?(c<d?d:c):e))?(((a<b?b:a)<(c<d?c:d
)?(c<d?c:d):(a<b?b:a))<((c<d?d:c)<e?(c<d?d:c):e)?((a<b?b:a)<(c<d?c:d)?(c<d?c:d):
(a<b?b:a)):((c<d?d:c)<e?(c<d?d:c):e)):((a<b?a:b)<((a<b?b:a)<(c<d?c:d)?(a<b?b:a):
(c<d?c:d))?((a<b?b:a)<(c<d?c:d)?(a<b?b:a):(c<d?c:d)):(a<b?a:b))) <((((a<b?b:a)<(
c<d?c:d)?(c<d?c:d):(a<b?b:a))<((c<d?d:c)<e?(c<d?d:c):e)?((c<d?d:c)<e?(c<d?d:c):e
):((a<b?b:a)<(c<d?c:d)?(c<d?c:d):(a<b?b:a)))<((c<d?d:c)<e?e:(c<d?d:c))?(((a<b?b:
a)<(c<d?c:d)?(c<d?c:d):(a<b?b:a))<((c<d?d:c)<e?(c<d?d:c):e)?((c<d?d:c)<e?(c<d?d:
c):e):((a<b?b:a)<(c<d?c:d)?(c<d?c:d):(a<b?b:a))):((c<d?d:c)<e?e:(c<d?d:c)))?(((a
<b?a:b)<((a<b?b:a)<(c<d?c:d)?(a<b?b:a):(c<d?c:d))?((a<b?b:a)<(c<d?c:d)?(a<b?b:a)
:(c<d?c:d)):(a<b?a:b))<(((a<b?b:a)<(c<d?c:d)?(c<d?c:d):(a<b?b:a))<((c<d?d:c)<e?(
c<d?d:c):e)?((a<b?b:a)<(c<d?c:d)?(c<d?c:d):(a<b?b:a)):((c<d?d:c)<e?(c<d?d:c):e))
?(((a<b?b:a)<(c<d?c:d)?(c<d?c:d):(a<b?b:a))<((c<d?d:c)<e?(c<d?d:c):e)?((a<b?b:a)
<(c<d?c:d)?(c<d?c:d):(a<b?b:a)):((c<d?d:c)<e?(c<d?d:c):e)):((a<b?a:b)<((a<b?b:a)
<(c<d?c:d)?(a<b?b:a):(c<d?c:d))?((a<b?b:a)<(c<d?c:d)?(a<b?b:a):(c<d?c:d)):(a<b?a
:b))):((((a<b?b:a)<(c<d?c:d)?(c<d?c:d):(a<b?b:a))<((c<d?d:c)<e?(c<d?d:c):e)?((c<
d?d:c)<e?(c<d?d:c):e):((a<b?b:a)<(c<d?c:d)?(c<d?c:d):(a<b?b:a)))<((c<d?d:c)<e?e:
(c<d?d:c))?(((a<b?b:a)<(c<d?c:d)?(c<d?c:d):(a<b?b:a))<((c<d?d:c)<e?(c<d?d:c):e)?
((c<d?d:c)<e?(c<d?d:c):e):((a<b?b:a)<(c<d?c:d)?(c<d?c:d):(a<b?b:a))):((c<d?d:c)<
e?e:(c<d?d:c)));}Marco13 hat gesagt.:erweitern wir die Aufgabenstellung auf "die mittlere von 7 Zahlen",
    static int mittel(int a,int b,int c,int d,int e, int f, int g){return x(a,b,c,d,e,f,g,4);}
    static int y(int a, int b, int c, int d, int e, int f, int g, int n){return x(a,b<c?b:c,b<c?c:b,d<e?d:e,d<e?e:d,f<g?f:g,f<g?g:f,n-1);}
    static int x(int a, int b, int c, int d, int e, int f, int g, int n){return n==0?c:y(a<b?a:b,a<b?b:a,c<d?c:d,c<d?d:c,e<f?e:f,e<f?f:e,g,n);}Ja!Atze hat gesagt.:boar, hab ihr alle nix zu tun oder wat?
