import java.util.Scanner;

 class Main {
    public static void main(String[] args) {
        int M,N,k,i,x,j=0,w;
        double prom =0;
        Scanner teclado = new Scanner(System.in);
        System.out.println("Cantidad de personas:");
        M = teclado.nextInt();
        System.out.println("Cantidad de numeros:");
        N = teclado.nextInt();
        int[] vector = new int[M*N];
        
        for(w=0;w < vector.length; w++){
            System.out.println("digite el dato: ");
            vector[w] = teclado.nextInt();
        }
        
        double[] promedio = new double[M];
        System.out.println("Digite k:");
        k = teclado.nextInt();//cantidad de datos a promediar
        i=(M*N)-1;//i = vector.length -1;
        while(i >= 0){
            for(x=0;x<k;x++){//Recorrer sub_Vector (k posiciones)
                prom += vector[i];
                i--;//Decrementar la i
            }
            promedio[j] = prom/k;
            prom = 0;
            j++;
            i = i - (N-k);
        }
        for(w=0;w < promedio.length; w++){
            System.out.print( String.format("%.2f",promedio[w]) + " ");
        }        
    } 
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: