1 PackageCom.xunhuan;2 3 ImportJava.util.Scanner;4 5 Public classZuoYe03 {6 7 8 Public Static voidMain (string[] args) {9Scanner meng00=NewScanner (system.in);Ten One A intmun; - intMax=0; - intMin=0; the - //Enter Do...while loop output - Do { -System.out.println ("Please enter a number (enter 0 to end)"); +Mun =meng00.nextint (); - if(mun!=0) {//If you determine the number of inputs if not equal to 0, enter + if(Mun>max) {//if the number of inputs is determined to be greater than the set maximum value, the value is assigned to the maximum value Amax=mun; at } - - if(mun<min) {//If the number entered is less than the minimum value, the value is assigned to the minimum value -min=mun; - } - if(min==0) {//If the minimum value is 0, then the input number is assigned to the minimum value inmin=mun; - } to + } - the} while(mun!=0);//the number entered cannot be 0, which is 0 to end the loop operation *System.out.print ("Maximum value is:" +max); $System.out.print ("Minimum value is:" +min); Panax Notoginseng } -}
Java Fundamentals (fifth post-course assignments) 03