星期一, 3月 20, 2006

lab Finding Max By For

//9224205
import 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

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 Taiwan License.