lab Finding Max By For
//9224205import java.io.*;
public class labFindingMaxByFor {
public static void main(String[] args) throws IOException{
BufferedReader keyboard= new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter number 1");
int max= Integer.parseInt(keyboard.readLine());
for (int i = 1; i<10;i++)
{
System.out.println("Enter number" + (i + 1));
String inputNumber = keyboard.readLine();
int inputNumberInt = Integer.parseInt(inputNumber.trim());
if (max < inputNumberInt)
max = inputNumberInt;
}
System.out.println("The biggest one is "+max);
}
}
0 Comments:
張貼留言
<< Home