Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package training_java;
- /**
- *
- * @author Victoria
- */
- public class Deference_between_values {
- int big_diff (int [] masiv){
- int k=-99999999;
- int l=99999999;
- int difference;
- System.out.print("Array = ");
- for (int i=0; i<masiv.length;i++){
- System.out.println(masiv[i]);
- }
- for (int i=0; i<masiv.length;i++){
- if (masiv[i]>k) {
- k=masiv[i];
- //System.out.println(masiv[i]);
- System.out.println(k);
- }
- }
- for (int i=0; i<masiv.length;i++){
- if (masiv[i]<l) {
- l=masiv[i];
- System.out.println(l);
- }
- }
- difference=k-l;
- return difference;
- }
- // difference=masiv[masiv.length-1]-masiv[0];
- // System.out.println("The difference between values " +difference);
- //int [] masiv ={10,3,4,6};
- void vuvod_masiva (int [] masiv) {
- for (int i=0; i<masiv.length;i++){
- System.out.println(masiv[i]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement