fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. int array[] = new int [10];
  13. int valorMax = 0;
  14. int valorMin = 0;
  15. int comparar;
  16. int contador = 0;
  17. System.out.println("Array: ");
  18.  
  19. for (int i = 0; i < array.length; i++) {
  20. comparar = (int) (Math.random()*100)+1;
  21. for(int y=0; y<array.length; y++){
  22. if(comparar==array[y]){
  23. contador ++;
  24. }
  25. }
  26.  
  27. array[i] = comparar;
  28.  
  29. System.out.print(array[i] + "//");
  30.  
  31. if (valorMax < comparar) {
  32. valorMax = comparar;
  33. }
  34.  
  35. if (valorMin > comparar || valorMin == 0) {
  36. valorMin=comparar;
  37. }
  38.  
  39. }
  40.  
  41. System.out.println("");
  42. System.out.println("El valor maximo es " + valorMax);
  43. System.out.println("El valor minimo es " + valorMin);
  44. System.out.println("NĂºmeros repe " + contador);
  45. }
  46. }
Success #stdin #stdout 0.05s 4575232KB
stdin
Standard input is empty
stdout
Array: 
84//9//73//50//30//39//16//73//4//49//
El valor maximo es 84
El valor minimo es 4
Números repe 1