Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class pruebas {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- System.out.println("Introduce un numero de cursos");
- int numero = sc.nextInt();
- cursos(numero);
- }
- public static void cursos(int numero) {
- int array[][] = new int[numero][11];
- int contador=0;
- int mayor=0;;
- for (int i = 0; i < array.length; i++) {
- System.out.println();
- for (int j = 0; j < array[i].length; j++) {
- array[i][j] = (int) (Math.random() * (10 - 1 + 1) + 1);
- System.out.print("[" + array[i][j] + "]");
- }
- }
- for (int i = 0; i < array.length; i++) {
- for (int j = 0; j < array[i].length; j++) {
- if(array[i][j]>5) {
- contador++;
- }
- }
- System.out.println( "\n Numero de aprobados "+contador);
- if(contador>mayor) {
- mayor=i;
- }
- contador=0;
- }
- System.out.println("El curso con mas aprobados es "+mayor);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement