public final class Kadai1 {
public static void main(String[] args) {
int max = -90;
double sinOfMax = Math.sin((double)max * Math.PI / 180.0);
int deg = 0;
double rad = 0.0;
double s = 0.0; // sin(rad) の値を一時的に保存
for (int i = 0; i < 10; i++) {
deg = (int)(Math.random() * 361);
System.out.print(deg + ", ");
rad = (double)deg * Math.PI / 180.0;
s = Math.sin(rad);
if (s > sinOfMax) {
max = deg;
sinOfMax = s;
}
}
System.out.println("");
System.out.println("sin(x) に最大値を与えたのは " + max);
}
}