Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void make_num(char *num1, char *num2, char *composition)
- {
- int a, d;
- int i,j, k;
- for (int i = 0; i < 50; i++)
- composition[i] = 48;
- for (int i = 0; i < strlen(num1); i++)
- for (int j = 0; j < strlen(num2); j++)
- {
- if (composition[i+j] == NULL)
- composition[i+j] = 48;
- if (composition[i + j] > 57)
- {
- if (composition[i+j+1] == NULL)
- composition[i+j+1] = 48;
- d = (composition[i + j] - 48)/10;
- composition[i + j] -=10*d;
- composition[j + i + 1] +=d;
- int k;
- k = i + j;
- while (composition[k] < 50)
- {
- if (composition[k] > 57)
- {
- }
- k++;
- }
- printf("1)A[i+j+1] = %c\n",composition[j + i + 1]);
- }
- a = (num1[i]-48) * (num2[j] - 48);
- if (a >= 10)
- {
- if (composition[i+j+1] == NULL)
- composition[i+j+1] = 48;
- d = a/10;
- composition[i+j] += a%10;
- composition[i+j+1] +=d;
- }
- if (a < 10)
- composition[j + i] += a;
- k = 0;
- while (k < 50)
- {
- if (composition[k] > 57)
- {
- if (composition[k + 1] == NULL)
- composition[k + 1] = 48;
- d = (composition[k] - 48)/10;
- composition[k] -=10*d;
- composition[k + 1] +=d;
- }
- k++;
- }
- if (composition[i + j] > 57)
- {
- if (composition[i+j+1] == NULL)
- composition[i+j+1] = 48;
- d = (composition[i + j] - 48)/10;
- composition[i + j] -=10*d;
- composition[j + i + 1] +=d;
- }
- }
- puts(composition);
- i = 0;
- while (composition[i] != 0)
- {
- if (composition[i] > 57)
- {
- if (composition[i+1] == NULL)
- composition[i+1] = 48;
- d = (composition[i] - 48)/10;
- composition[i] -=10*d;
- composition[i + 1] +=d;
- }
- i++;
- }
- puts(composition);
- }
Advertisement
Add Comment
Please, Sign In to add comment