回答編集履歴

5

修正

2017/08/03 03:26

投稿

退会済みユーザー
test CHANGED
@@ -33,8 +33,6 @@
33
33
  {
34
34
 
35
35
  printf(" %d", array[i]);
36
-
37
-
38
36
 
39
37
  if(array[i] < 0) continue;
40
38
 

4

修正

2017/08/03 03:26

投稿

退会済みユーザー
test CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
 
14
14
 
15
- int min = -1, max = 0;
15
+ int min = -1, max = -1;
16
16
 
17
17
  int average = 0, count = 0;
18
18
 

3

修正

2017/08/03 03:25

投稿

退会済みユーザー
test CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
 
14
14
 
15
- int min = 0, max = 0;
15
+ int min = -1, max = 0;
16
16
 
17
17
  int average = 0, count = 0;
18
18
 
@@ -40,7 +40,7 @@
40
40
 
41
41
  if(max < array[i]) max = array[i];
42
42
 
43
- min = array[i];
43
+ if(min < 0 || min > array[i]) min = array[i];
44
44
 
45
45
  average += array[i];
46
46
 

2

修正

2017/08/03 03:24

投稿

退会済みユーザー
test CHANGED
@@ -16,21 +16,17 @@
16
16
 
17
17
  int average = 0, count = 0;
18
18
 
19
- int check = 0;
20
19
 
21
20
 
22
-
23
- int i, j, _t;
21
+ int i;
24
22
 
25
23
  int l = sizeof(array) / sizeof(array[0]);
26
24
 
27
25
 
28
26
 
29
- //ソート
30
-
31
27
  printf("Score>");
32
28
 
33
-
29
+
34
30
 
35
31
  for(i = 0; i < l; i++)
36
32
 
@@ -40,65 +36,19 @@
40
36
 
41
37
 
42
38
 
43
- for(j = 0; j < l - 1; j++)
44
-
45
- {
46
-
47
- _t = array[j];
48
-
49
-
50
-
51
- if(array[j] < array[j + 1])
52
-
53
- {
54
-
55
- array[j] = array[j + 1];
56
-
57
- array[j + 1] = _t;
58
-
59
- }
60
-
61
- }
62
-
63
- }
64
-
65
-
66
-
67
- //点数の表示
68
-
69
-
70
-
71
-
72
-
73
- for(i = 0; i < l; i++)
74
-
75
- {
76
-
77
39
  if(array[i] < 0) continue;
78
40
 
79
-
80
-
81
- if(check == 0)
82
-
83
- {
84
-
85
- max = array[i];
41
+ if(max < array[i]) max = array[i];
86
-
87
- check ++;
88
-
89
- }
90
-
91
-
92
42
 
93
43
  min = array[i];
94
44
 
95
- average += min;
45
+ average += array[i];
96
46
 
97
47
  count ++;
98
48
 
99
49
  }
100
50
 
101
-
51
+
102
52
 
103
53
  printf("\nAverage: %.1f\n", (float)average / count);
104
54
 

1

修正

2017/08/03 03:19

投稿

退会済みユーザー
test CHANGED
@@ -28,9 +28,17 @@
28
28
 
29
29
  //ソート
30
30
 
31
+ printf("Score>");
32
+
33
+
34
+
31
35
  for(i = 0; i < l; i++)
32
36
 
33
37
  {
38
+
39
+ printf(" %d", array[i]);
40
+
41
+
34
42
 
35
43
  for(j = 0; j < l - 1; j++)
36
44
 
@@ -58,17 +66,13 @@
58
66
 
59
67
  //点数の表示
60
68
 
61
- printf("Score>");
69
+
62
70
 
63
71
 
64
72
 
65
73
  for(i = 0; i < l; i++)
66
74
 
67
75
  {
68
-
69
- printf(" %d", array[i]);
70
-
71
-
72
76
 
73
77
  if(array[i] < 0) continue;
74
78
 
@@ -112,7 +116,7 @@
112
116
 
113
117
  ```
114
118
 
115
- Score> 98 87 78 63 54 43 -1
119
+ Score> 43 87 78 63 54 43 -1
116
120
 
117
121
  Average: 70.5
118
122