Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - [[java]] Enter an integer array, then find out the largest and smallest elements in the array, and finally output the array in reverse order. How to program
[[java]] Enter an integer array, then find out the largest and smallest elements in the array, and finally output the array in reverse order. How to program
Import? Java . util . scanner;

Public? Class? Testing? {

Public? Static electricity Invalid? Mainly? (String[]? args)? {

Scanner? Scanner? =? New? Scanner (system. in);

int? Count? =? 0;

int? Temperature;

int? Max. min

System.out.println ("Please enter the size of the array");

Count? =? scanner . nextint();

System.out.println ("Please enter an array:");

int[]? Numbers? =? New? int[count];

For what? (int? Me? =? 0; ? Me? & lt? Count; ? i++)

Number [i]? =? scanner . nextint();

system . out . println(" array is:");

For what? (int? Me? =? 0; ? Me? & lt? Numbers. Length; ? i++)

system . out . println(numbers[I]);

Max. =? Min? =? Number [0];

For what? (int? Me? =? 0; ? Me? & lt? Numbers. Length; ? i++)? {

What if? (max? & lt? Number [i])? {

Max. =? Number [I];

}

What if? (min? & gt? Number [i])? {

Min? =? Number [I];

}

}

System.out.println ("What is the maximum quantity?"? +? Max. +? What is the minimum quantity? +? min);

For what? (int? Me? =? 0; ? Me? & lt? Numbers. Length? /? 2; ? i++)? {

Temporary workers? =? Number [I];

Number [i]? =? Numbers [counting? -? 1? -? I];

Numbers [counting? -? 1? -? Me]? =? Temperature;

}

System.out.println ("The reverse order of the array is:");

For what? (int? Me? =? 0; ? Me? & lt? Numbers. Length; ? i++)? {

system . out . println(numbers[I]);

}

}

}