teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

4

誤字脱字

2021/07/03 13:05

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -1,7 +1,3 @@
1
- 1000の階乗の値を計算したいです。
2
-
3
-
4
-
5
1
  ```ここに言語を入力
6
2
  #include <stdio.h>
7
3
 
@@ -34,5 +30,4 @@
34
30
 
35
31
  return 0;
36
32
  }
37
- ```
33
+ ```
38
- 足りない点や間違っているところを教えていただきたいです

3

誤字

2021/07/03 13:05

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -7,29 +7,32 @@
7
7
 
8
8
  int main(void)
9
9
  {
10
- int a[10000];
10
+ int a[10000];
11
- int n, i, j, carry, tmp;
11
+ int n, i, j, carry, tmp;
12
12
 
13
- a[0] = 1;
13
+ a[0] = 1;
14
- n = 1;
14
+ n = 1;
15
15
 
16
- for (i=2; i<=1000; i++) {
16
+ for (i=2; i<=1000; i++) {
17
- carry = 0;
17
+ carry = 0;
18
- for (j=0; j<n; j++) {
18
+ for (j=0; j<n; j++) {
19
-
20
- }
21
- if (carry != 0) {
22
- a[n] = carry;
19
+ a[j] = a[j] * i + carry;
20
+ carry = a[j] / a;
23
- n++;
21
+ a[j] = a[j] % 10000;
24
- }
25
- }
26
22
 
27
- for (j=n-1; j>=0; j--) {
28
- printf("%04d", a[j]);
29
23
  }
30
- printf("\n");
24
+ if (carry != 0) {
25
+ a[n] = carry;
26
+ n++;
27
+ }
28
+ }
31
29
 
30
+ for (j=n-1; j>=0; j--) {
31
+ printf("%04d", a[j]);
32
+ }
33
+ printf("\n");
34
+
32
- return 0;
35
+ return 0;
33
36
  }
34
37
  ```
35
38
  足りない点や間違っているところを教えていただきたいです

2

誤字

2021/07/03 12:34

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -1,6 +1,8 @@
1
1
  1000の階乗の値を計算したいです。
2
2
 
3
+
4
+
3
- ```
5
+ ```ここに言語を入力
4
6
  #include <stdio.h>
5
7
 
6
8
  int main(void)
@@ -29,6 +31,5 @@
29
31
 
30
32
  return 0;
31
33
  }
32
- ``
34
+ ```
33
-
34
35
  足りない点や間違っているところを教えていただきたいです

1

誤字

2021/07/01 08:06

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -1,5 +1,6 @@
1
1
  1000の階乗の値を計算したいです。
2
2
 
3
+ ```
3
4
  #include <stdio.h>
4
5
 
5
6
  int main(void)
@@ -28,5 +29,6 @@
28
29
 
29
30
  return 0;
30
31
  }
32
+ ``
31
33
 
32
34
  足りない点や間違っているところを教えていただきたいです