/* Integer multiplication of large numbers */# include <stdio. h> # include <stdlib. h> # include <string. h> char * bigmuilty (char * muiltied, int len1, char * muilty, int len2) // muiltied is the multiplier and len1 is the length. Muilty is the multiplier, and len2 is the length {int len; int I = 0; int j = 0; int k = 0; int tmp_result = 0; int carry = 0; char * result; len = len1 + len2; // their maximum length is the length of the multiplier and result = (char *) calloc (len, 1 ); // dynamically allocate memory for (I = 0; I <len2; I ++) // use each bit of the multiplier to multiply it by the multiplier {for (j = 0; j <len1; j ++) {tmp_result = muilty [len2-i-1] * muiltied [len1-j-1]; // obtain the zero-point result [j + I] + = tmp_result; // If the start number is 0 and the subscripts of the multiplier are increased from right to left, the result is stored in j + I} for (k = 0; k <= j + I-1; k ++) // sort the results so that each value is between 0-9 {if (result [k]> 9) {carry = result [k]/10; result [k] = result [k] % 10; result [k + 1] + = carry ;}} return result ;} int main () {int len1 = 0; int len2 = 0; int len; int I = 0; int num = '0'; char * result; char muiltied [BUFSIZ]; // The storage location of the multiplier char muilty [BUFSIZ]; printf ("entry muiltied:"); scanf ("% s", muiltied); printf ("\ nentry muilty :"); scanf ("% s", muilty); len1 = strlen (muiltied); len2 = strlen (muilty); len = len1 + len2; for (I = 0; I <len1; I ++) {muiltied [I] = muiltied [I]-num;} for (I = 0; I <len2; I ++) {muilty [I] = muilty [I]-num;} result = bigmuilty (muiltied, len1, muilty, len2); I = len-2; printf ("\ nresult :"); if (result [len-1]> 0) {printf ("% c", result [len-1] + num);} while (I> = 0) {printf ("% c", result [I] + num); I --;} printf ("\ n"); free (result); return 0 ;}