没什么说的,seq[i+j]是新东西,别的都和大整数加法一样
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int num1[201],num2[201],seq[4010];
char s1[201],s2[201];
int i,j,k;
int len1,len2;
scanf("%s%s", s1, s2);
memset(num1,0,sizeof(num1));
memset(num2,0,sizeof(num2));
memset(seq,0,sizeof(seq));
len1 = strlen(s1);
len2 = strlen(s2);
k = 0;
for(i=len1-1; i>=0; i--)
{
num1[k++] = s1[i] - '0';
}
k = 0;
for(i=len2-1; i>=0; i--)
{
num2[k++] = s2[i] - '0';
}
for(i=0; i<len1; i++)
{
for(j=0; j<len2; j++)
{
seq[i+j] += num1[i] * num2[j]; //核心语句.
}
}
for(i=0; i<4010; i++)
{
if(seq[i] > 9)
{
seq[i+1] += seq[i] / 10;
seq[i] %= 10;
}
}
i=4009;
while(!seq[i])
{
i--;
}
for(j=i;j>=0;j--)
{
printf("%d" ,seq[j]);
}
system("pause");
return 0;
}