質問編集履歴
3
test
CHANGED
File without changes
|
test
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
while(i<100){
|
22
22
|
|
23
|
-
if ((i % 2) =
|
23
|
+
if ((i % 2) = 0)
|
24
24
|
|
25
25
|
count++;
|
26
26
|
|
@@ -32,7 +32,7 @@
|
|
32
32
|
|
33
33
|
|
34
34
|
|
35
|
-
if((i % 2)=
|
35
|
+
if((i % 2)=0 && (i%3)=0){
|
36
36
|
|
37
37
|
count++;
|
38
38
|
|
2
test
CHANGED
File without changes
|
test
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
|
20
20
|
|
21
|
-
while(i<100
|
21
|
+
while(i<100){
|
22
22
|
|
23
23
|
if ((i % 2) == 1 )
|
24
24
|
|
@@ -28,7 +28,7 @@
|
|
28
28
|
|
29
29
|
}
|
30
30
|
|
31
|
-
printf("
|
31
|
+
printf("M 1=%d\n",count);
|
32
32
|
|
33
33
|
|
34
34
|
|
@@ -40,7 +40,7 @@
|
|
40
40
|
|
41
41
|
}
|
42
42
|
|
43
|
-
printf("
|
43
|
+
printf("M 2=%d\n",count);
|
44
44
|
|
45
45
|
|
46
46
|
|
1
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -3,3 +3,47 @@
|
|
3
3
|
1~100までの数で、2の倍数の数の個数と2の倍数だが、3の倍数でない数の個数を
|
4
4
|
|
5
5
|
出すにはどうすればよいですか。
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
#include <stdio.h>
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
int main (void){
|
14
|
+
|
15
|
+
int i=1;
|
16
|
+
|
17
|
+
int count=0;
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
while(i<1000){
|
22
|
+
|
23
|
+
if ((i % 2) == 1 )
|
24
|
+
|
25
|
+
count++;
|
26
|
+
|
27
|
+
i++;
|
28
|
+
|
29
|
+
}
|
30
|
+
|
31
|
+
printf("Condition 1=%d\n",count);
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
if((i % 2)==1 && (i%3)==0){
|
36
|
+
|
37
|
+
count++;
|
38
|
+
|
39
|
+
i++;
|
40
|
+
|
41
|
+
}
|
42
|
+
|
43
|
+
printf("Condition 2=%d\n",count);
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
return 0;
|
48
|
+
|
49
|
+
}
|