1Answers
Write programs with Java, read 10 intenses from the keyboard to the array, output maximum, minimum
Asked by: Paul Davis 249 views IT
Write programs with Java, read 10 intenses from the keyboard to the array, output maximum, minimum
+5Votes
This basic program is best done, reference:
public static void main (string [] args) { min = a [i];
int [] a = new int [10]; // declaration An integer array
INT I;
Scanner sc = new scanner (system.in);
FOR (i = 0; i <10; i ++) {
a [ I] = sc.nextint (); // Receive the user’s input, initialize one by one by one member,
}
Int max, min;
max = min = a [0]; // first take The first
for (i = 1; I <10; i ++) {
if (a [i]> max)
max = a [i];
IF (a [i]
}
system.out.printf (“maximum:% D, minimum value% D \ n”, max, min);
}