Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1.  
  2. import javax.swing.JOptionPane;
  3.  
  4.  
  5. public class Main {
  6. public static void main(String[] Args )
  7. {
  8. minWekt = new minWekt();
  9. }
  10. public minWekt
  11.  
  12. static {
  13. int n, i, min, poloz;
  14. // n - rozmiar wektora
  15. // min - wartość elementu minimalnego
  16. //poloz - położenie elementu minimalnego
  17. String odp = JOptionPane.showInputDialog("Podaj liczbe elementow");
  18. n = Integer.parseInt(odp);
  19. int[]t = new int[n];
  20. Tablice.czytajTab(t);
  21. Tablice.drukTab(t,"Wczytana tablica");
  22.  
  23. min = t[0];
  24. poloz = 0;
  25. for (i=1;i<n;i++)
  26. if (t[i]<min){
  27. min = t[i];
  28. poloz=i;
  29. }
  30. JOptionPane.showMessageDialog(null, "min = " +min, "Położenie el. min = "+poloz, JOptionPane.INFORMATION_MESSAGE);
  31. System,exit(0);
  32.  
  33.  
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement