35_longfactorial.c 268 B

12345678910111213
  1. #include <gmp.h>
  2. #include <stdio.h>
  3. int main()
  4. {
  5. int n = 100;
  6. mpz_t factorial;
  7. mpz_init_set_ui(factorial, 1);
  8. for (int i = 1; i <= n; i++)
  9. mpz_mul_ui(factorial, factorial, i);
  10. printf("Factorial of %d is %s\n", n, mpz_get_str(NULL, 10, factorial));
  11. return 0;
  12. }