* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package programame1;
import java.util.Scanner;
/**
*
* @author Santi
*/
public class UVA11727_Recortes {
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
int num1, num2, num3;
int cant = entrada.nextInt();
for (int i = 1; i <= cant; i++) {
num1 = entrada.nextInt();
num2 = entrada.nextInt();
num3 = entrada.nextInt();
System.out.println("Case " + i + ": " + numeroMedio(num1, num2, num3));
}
}
static int numeroMedio(int a, int b, int c) {
int max, min;
max = Math.max(a, b);
max = Math.max(max, c);
min = Math.min(a, b);
min = Math.min(c, min);
if (a != max && a != min) {
return a;
} else if (b != max && b != min) {
return b;
} else {
return c;
}
}
}
No hay comentarios:
Publicar un comentario