Raizekas

Untitled

Mar 17th, 2021
33
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package skaiciavimoobjektai;
  2.  
  3. public class MinMaxRadimas
  4. {
  5. public int maxReiksme(int[] masyvas)
  6. {
  7. int max = masyvas[0];
  8. for (int i = 0; i < masyvas.length; i++)
  9. {
  10. if (masyvas[i] > max)
  11. {
  12. max = masyvas[i];
  13. }
  14. }
  15. return max;
  16. }
  17.  
  18.  
  19. public int minReiksme(int[] masyvas)
  20. {
  21. int min = masyvas[0];
  22. for (int i = 0; i < masyvas.length; i++)
  23. {
  24. if (masyvas[i] < min)
  25. {
  26. min = masyvas[i];
  27. }
  28. }
  29. return min;
  30. }
  31. }
  32.  
RAW Paste Data