一个20位数与一个一位数的乘法
# include <stdio.h>void main()
{
int a[20],b[21],x,i,j,k,m,n;
printf("Please input a number:\n");
for(i=0;i<20;i++)
scanf("%d",&a[i]);
printf("input another number x:");
scanf("%d",&x);
n=0;
i=19;
j=0;
while(j<=19)
{
b[j]=a[i]*x+n;
n=b[j]/10;
b[j]=b[j]%10;
i--;
j++;
}
if(n==0)
m=19;
else
{
b[20]=n;
m=20;
}
printf("The answer is:\n");
for(k=m;k>=0;k--)
printf("%d",b[k]);
}