Skip to content

Instantly share code, notes, and snippets.

@mneko22
Last active November 24, 2015 03:05
Show Gist options
  • Save mneko22/c11dedf1a472f0284164 to your computer and use it in GitHub Desktop.
Save mneko22/c11dedf1a472f0284164 to your computer and use it in GitHub Desktop.
test
import java.util.*;
class Test
{
public static void main(String[] args)
{
//人数分の変数を宣言しなければならない
int a1,a2,a3,a4,a5 ... a100;
double ave;
Scanner scan=next Scanner(System.in);
//テストの点数を代入
a1 = 30;
a2 = 45;
...
a100 = 67;
//平均点を求める変数に a1~a100 の点数と人数で割った数を代入
ave = (a1 + a2 + ... a100) / 5;
//平均点を表示
System.out.println(ave);
}
}
import java.IO.*;
class Kumatyan
{
public static void main(String[] args)throws IOException
{
double ave;
int temp;
//100個の棚が入る配列(タンス)を作成する
int[] a = new int[100];
//点数の値を代入
BufferedReader br =
new BufferedReader(new InputStreamReader(System,in));
for(int i = 0; i > a.length; i++){
a[i] = br.readLine();
temp += a[i];
}
ave = temp / a.length;
System.out.println(ave);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment