質問編集履歴

3

解決しました。

2019/01/26 09:42

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -27,105 +27,3 @@
27
27
 
28
28
 
29
29
  ご教授いただけるとうれしいです。よろしくお願いします。
30
-
31
-
32
-
33
-
34
-
35
- ```ここに言語を入力
36
-
37
- class Sumtoave{
38
-
39
- public static void main(String args[])throws IOException{
40
-
41
-
42
-
43
- int sum=0;
44
-
45
- int ave=0;
46
-
47
- int calcu=0;
48
-
49
-
50
-
51
- //キーボード入力して文字を数字に変換
52
-
53
-
54
-
55
- System.out.println("整数の個数を入力");
56
-
57
- BufferedReader br = new BufferedReader( new InputStreamReader(System.in));
58
-
59
-
60
-
61
- String str=br.readLine();
62
-
63
- int input=Integer.parseInt(str);
64
-
65
-
66
-
67
- //合計と平均を求める
68
-
69
-
70
-
71
- for(int x=0;x<input;x++){
72
-
73
- System.out.println((x+1)+"つ目の整数");
74
-
75
- int t=Integer.parseInt(br.readLine());
76
-
77
- sum+=t;
78
-
79
- }
80
-
81
- ave=sum/input;
82
-
83
- /*
84
-
85
-
86
-
87
- //配列に入れる
88
-
89
- int [] num =new int[input];
90
-
91
-
92
-
93
- //入力した数字が平均を超えているか
94
-
95
-
96
-
97
- if(ave<input){
98
-
99
- str=br.readLine();
100
-
101
- int n=Integer.parseInt(str);
102
-
103
- calcu=n;
104
-
105
- }else{
106
-
107
- System.out.println("ちがう");
108
-
109
- }
110
-
111
- */
112
-
113
-
114
-
115
- //表示
116
-
117
- System.out.println("合計"+sum);
118
-
119
- System.out.println("平均"+ave);
120
-
121
- System.out.println("超えた"+calcu);
122
-
123
-
124
-
125
-
126
-
127
- }
128
-
129
- }
130
-
131
- ```

2

追記

2019/01/26 09:42

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -30,13 +30,9 @@
30
30
 
31
31
 
32
32
 
33
- import java.io.BufferedReader;
34
-
35
- import java.io.IOException;
36
-
37
- import java.io.InputStreamReader;
38
33
 
39
34
 
35
+ ```ここに言語を入力
40
36
 
41
37
  class Sumtoave{
42
38
 
@@ -131,3 +127,5 @@
131
127
  }
132
128
 
133
129
  }
130
+
131
+ ```

1

添削お願いします。

2019/01/26 06:41

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -27,3 +27,107 @@
27
27
 
28
28
 
29
29
  ご教授いただけるとうれしいです。よろしくお願いします。
30
+
31
+
32
+
33
+ import java.io.BufferedReader;
34
+
35
+ import java.io.IOException;
36
+
37
+ import java.io.InputStreamReader;
38
+
39
+
40
+
41
+ class Sumtoave{
42
+
43
+ public static void main(String args[])throws IOException{
44
+
45
+
46
+
47
+ int sum=0;
48
+
49
+ int ave=0;
50
+
51
+ int calcu=0;
52
+
53
+
54
+
55
+ //キーボード入力して文字を数字に変換
56
+
57
+
58
+
59
+ System.out.println("整数の個数を入力");
60
+
61
+ BufferedReader br = new BufferedReader( new InputStreamReader(System.in));
62
+
63
+
64
+
65
+ String str=br.readLine();
66
+
67
+ int input=Integer.parseInt(str);
68
+
69
+
70
+
71
+ //合計と平均を求める
72
+
73
+
74
+
75
+ for(int x=0;x<input;x++){
76
+
77
+ System.out.println((x+1)+"つ目の整数");
78
+
79
+ int t=Integer.parseInt(br.readLine());
80
+
81
+ sum+=t;
82
+
83
+ }
84
+
85
+ ave=sum/input;
86
+
87
+ /*
88
+
89
+
90
+
91
+ //配列に入れる
92
+
93
+ int [] num =new int[input];
94
+
95
+
96
+
97
+ //入力した数字が平均を超えているか
98
+
99
+
100
+
101
+ if(ave<input){
102
+
103
+ str=br.readLine();
104
+
105
+ int n=Integer.parseInt(str);
106
+
107
+ calcu=n;
108
+
109
+ }else{
110
+
111
+ System.out.println("ちがう");
112
+
113
+ }
114
+
115
+ */
116
+
117
+
118
+
119
+ //表示
120
+
121
+ System.out.println("合計"+sum);
122
+
123
+ System.out.println("平均"+ave);
124
+
125
+ System.out.println("超えた"+calcu);
126
+
127
+
128
+
129
+
130
+
131
+ }
132
+
133
+ }