★★ Java の宿題ここで答えます Part 68 ★★at TECH
★★ Java の宿題ここで答えます Part 68 ★★ - 暇つぶし2ch289:デフォルトの名無しさん
09/10/03 00:40:13
>>287
import java.io.*;
class k3_1 {
public static void main(String[] args) {
try {
BufferedReader br = new BufferedReader(new FileReader("test2.txt"));
double[] test = new double[5];
for (int i = 0; i < test.length; i++) {
String str = br.readLine();
test[i] = Double.parseDouble(str);
}
double max = test[0], min = test[0], s1 = 0, s2 = 0;
for (int i = 0; i < test.length; i++) {
if (max < test[i]) max = test[i];
if (min > test[i]) min = test[i];
s1 += test[i] / test.length;
s2 += test[i] * test[i] / test.length;
System.out.println(test[i]);
}
System.out.println("最高点は" + max + "です");
System.out.println("最低点は" + min + "です");
System.out.printf("標準偏差は%7.5fです%n", Math.sqrt(s2 - s1 * s1));
br.close();
} catch (IOException e) {
System.out.println("入出力エラーです");
}
}
}


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch