Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. public class Main {
  2.  
  3. public static void main(String[] args) {
  4.  
  5.  
  6. int [] arr= {5, 50, 3, 42, 18, 16, 8, 30, 44}; // Array
  7. menorD l = new menorD();
  8.  
  9. menorD.MinD(arr);
  10.  
  11. }
  12.  
  13. }
  14.  
  15. public class menorD {
  16.  
  17. static int arr_zise;
  18.  
  19.  
  20. public static void minD (int [] arr) {
  21.  
  22. arr_zise = arr.length;
  23. int i, j;
  24. int minD=0;
  25.  
  26. for(i=0;i<arr_zise; i++) {
  27.  
  28. for(j=0;j<arr_zise; j++) {
  29.  
  30. if(arr[i]!=arr[j]) {
  31. minD=arr[i]-arr[j];
  32.  
  33. System.out.print(" i="+ arr[i]+ " j="+ arr[j]+ " minD es: "+Math.abs(min));
  34. System.out.println();
  35.  
  36. }
  37.  
  38.  
  39. }
  40.  
  41. }
  42.  
  43.  
  44. }
  45.  
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement