Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package training_java;
  7.  
  8. /**
  9. *
  10. * @author Victoria
  11. */
  12. public class Deference_between_values {
  13. int big_diff (int [] masiv){
  14. int k=-99999999;
  15. int l=99999999;
  16. int difference;
  17. System.out.print("Array = ");
  18. for (int i=0; i<masiv.length;i++){
  19. System.out.println(masiv[i]);
  20. }
  21. for (int i=0; i<masiv.length;i++){
  22. if (masiv[i]>k) {
  23. k=masiv[i];
  24. //System.out.println(masiv[i]);
  25. System.out.println(k);
  26. }
  27. }
  28. for (int i=0; i<masiv.length;i++){
  29. if (masiv[i]<l) {
  30. l=masiv[i];
  31. System.out.println(l);
  32. }
  33. }
  34. difference=k-l;
  35. return difference;
  36. }
  37. // difference=masiv[masiv.length-1]-masiv[0];
  38. // System.out.println("The difference between values " +difference);
  39. //int [] masiv ={10,3,4,6};
  40. void vuvod_masiva (int [] masiv) {
  41. for (int i=0; i<masiv.length;i++){
  42. System.out.println(masiv[i]);
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement