Bignumber Multiplication


 
void Multiplication(char *f, char *s, char *sum){
	int lenf,lens,i,j,k,carry,a;
	memset(sum,0,sizeof(sum));
	lenf = strlen(f);lens = strlen(s);
	reverse(f,f+lenf);reverse(s,s+lens);
	for(i=0;i < lens;i++){
		carry = 0;k = i;
		for(j=0;j < lenf;j++){
			a = ( (f[j]-'0') * (s[i]-'0') ) + carry;
			if(i) a += (sum[k]-'0');
			sum[k++] = (a%10) + '0';
			carry = a/10;
		}
		if(carry)sum[k++] = carry + '0';
		sum[k++] = '0';
	}
	for(k--;k >=0;k--)if(sum[k]!='0')break;
	sum[++k] = 0;
	reverse(sum,sum+k);
}