くだすれJava(超初心者用) その2
■ このスレッドは過去ログ倉庫に格納されています
0862デフォルトの名無しさん
2008/04/14(月) 00:02:54import java.util.Scanner;
class ex0313 {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
System.out.print("整数a:"); int a = stdIn.nextInt();
System.out.print("整数b:"); int b = stdIn.nextInt();
System.out.print("整数c:"); int c = stdIn.nextInt();
int mid = a;
if (a > b) {
if (b > c)
mid = b;
else if (c < a)
mid = c;
} else {
if (a > c)
mid = a;
else if (c > b)
mid = b;
else
mid = c;
}
System.out.println("中央値は" + mid + "です。");
}
}
■ このスレッドは過去ログ倉庫に格納されています