Advertisement
Guest User

Untitled

a guest
Feb 25th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.96 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class pruebas {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner sc = new Scanner(System.in);
  7.         System.out.println("Introduce un numero de cursos");
  8.         int numero = sc.nextInt();
  9.         cursos(numero);
  10.  
  11.     }
  12.  
  13.     public static void cursos(int numero) {
  14.         int array[][] = new int[numero][11];
  15.         int contador=0;
  16.         int mayor=0;;
  17.  
  18.         for (int i = 0; i < array.length; i++) {
  19.  
  20.             System.out.println();
  21.  
  22.             for (int j = 0; j < array[i].length; j++) {
  23.  
  24.                 array[i][j] = (int) (Math.random() * (10 - 1 + 1) + 1);
  25.  
  26.                 System.out.print("[" + array[i][j] + "]");
  27.  
  28.             }
  29.  
  30.         }
  31.  
  32.         for (int i = 0; i < array.length; i++) {
  33.  
  34.             for (int j = 0; j < array[i].length; j++) {
  35.  
  36.                 if(array[i][j]>5) {
  37.                     contador++;
  38.                 }
  39.                
  40.             }
  41.             System.out.println( "\n Numero de aprobados "+contador);
  42.             if(contador>mayor) {
  43.                 mayor=i;
  44.             }
  45.             contador=0;
  46.         }
  47.        
  48.         System.out.println("El curso con mas aprobados es "+mayor);
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement