0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

合計点、平均点の求め方

Posted at

public class Main {
public static void main(String[] args) {
int [] scores = {20, 30, 40, 50, 80};
int sum = 0; //集計結果
for (int i = 0; i < scores.length; i++) {
sum += scores[i]; //変数sumに合算
}

	int avg = sum / scores.length;
	System.out.println("合計点:" + sum);
	System.out.println("平均点:" + avg);
	
}

}

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?