YorKnEz

Untitled

Oct 13th, 2020
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. typedef struct nrMare {
  4. int x[1000];
  5. int len = 0;
  6. } nrMare;
  7.  
  8. int n;
  9. nrMare N;
  10.  
  11. int inmultire (int n) {
  12. int t = 0, c;
  13.  
  14. for (int i = 0; i < N.len; i++) {
  15. c = N.x[i] * n + t;
  16. N.x[i] = c % 10;
  17. t = c / 10;
  18. }
  19.  
  20. while (t) {
  21. N.x[N.len++] = t % 10;
  22. t /= 10;
  23. }
  24. }
  25.  
  26. int main() {
  27. scanf("%d", &n);
  28.  
  29. N.x[0] = 1; N.len = 1;
  30.  
  31. for (int i = 3; i <= n-1; i++) {
  32. inmultire(i);
  33. }
  34.  
  35. for (int i = N.len - 1; i >= 0; i--) {
  36. printf("%d", N.x[i]);
  37. }
  38.  
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment