max
程式碼
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Untitled2 {
public static void main(String[] args)throws IOException {
BufferedReader keyboard=new BufferedReader(new InputStreamReader(System.in));
double a=0;
String input;
System.out.println("請輸入十個數");
int count;
double b=Double.parseDouble(keyboard.readLine());
for(count=1;count<10;count++) { input=keyboard.readLine(); a=Double.parseDouble(input); System.out.println("input="+a);
if[b小於a]
{
b=a;
}
else
b=b;
System.out.println("最大數為"+b);
}
}
0 Comments:
发表评论
<< Home