实验二
'''
include <stdio.h>
include <stdlib.h>
include <string.h>
include <openssl/bn.h>
int main()
{
BIGNUM *product, *num;
char *str;
int i;
// 初始化大数库
BN_CTX *ctx = BN_CTX_new();
product = BN_new();
num = BN_new();
str = BN_bn2dec(product);
BN_set_word(product, 1);
// 计算20201211到20201226的乘积
for (i=20201211; i<=20201226; i++) {
BN_set_word(num, i);
BN_mul(product, product, num, ctx);
}
// 输出结果
str = BN_bn2dec(product);
printf("20201211到20201226的乘积为: %s\n", str);
// 释放内存
BN_free(num);
BN_free(product);
BN_CTX_free(ctx);
free(str);
return 0;
}
'''