args変数の最大数とargの最大値と最小値の最大差を計算するコードを記述しています。args変数の最大値と最大値の差
現在、私のコードは次のようになります。それは戻った回数
public void main(String [] args) {
System.out.println(args[0]);
SimpleCalc fm = new SimpleCalc();
**System.out.println(fm.max(nums));**
**System.out.println(fm.max(nums) - fm.min(nums));**
上の数字の合計を割ることによって
public int max(int [] args) {//array of ints
int m = args[0]; // first element
//initialisation; condition; update
for (int j = 1; j < args.length; ++j) {
// statement in a block:
if (m < args[j]) {
m = nums[j];
// if m is less than the j-th element
// then store this new smaller value
}
}
return m;
}
public int min(int [] args) {//array of integerss
int mi = nums[0]; // first element
//initialisation; condition; update
for (int j = 1; j < args.length; ++j) {
// statement in a block:
if (mi > args[j]) {
mi = args[j];
// if m is greater than the j-th element
// then store this new largest value
}
}
return mi;
} //計算平均配列を使ったときの値ですが、argsでコンパイルしたようです。この問題を解決する方法がわからない