Cheeel666

Untitled

Oct 6th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. void make_num(char *num1, char *num2, char *composition)
  2. {
  3. int a, d;
  4. int i,j, k;
  5.  
  6. for (int i = 0; i < 50; i++)
  7. composition[i] = 48;
  8. for (int i = 0; i < strlen(num1); i++)
  9. for (int j = 0; j < strlen(num2); j++)
  10. {
  11. if (composition[i+j] == NULL)
  12. composition[i+j] = 48;
  13. if (composition[i + j] > 57)
  14. {
  15. if (composition[i+j+1] == NULL)
  16. composition[i+j+1] = 48;
  17. d = (composition[i + j] - 48)/10;
  18. composition[i + j] -=10*d;
  19. composition[j + i + 1] +=d;
  20. int k;
  21. k = i + j;
  22. while (composition[k] < 50)
  23. {
  24. if (composition[k] > 57)
  25. {
  26.  
  27. }
  28. k++;
  29. }
  30. printf("1)A[i+j+1] = %c\n",composition[j + i + 1]);
  31.  
  32. }
  33. a = (num1[i]-48) * (num2[j] - 48);
  34. if (a >= 10)
  35. {
  36. if (composition[i+j+1] == NULL)
  37. composition[i+j+1] = 48;
  38. d = a/10;
  39. composition[i+j] += a%10;
  40. composition[i+j+1] +=d;
  41.  
  42.  
  43. }
  44. if (a < 10)
  45. composition[j + i] += a;
  46. k = 0;
  47. while (k < 50)
  48. {
  49. if (composition[k] > 57)
  50. {
  51. if (composition[k + 1] == NULL)
  52. composition[k + 1] = 48;
  53. d = (composition[k] - 48)/10;
  54. composition[k] -=10*d;
  55. composition[k + 1] +=d;
  56. }
  57. k++;
  58. }
  59. if (composition[i + j] > 57)
  60. {
  61. if (composition[i+j+1] == NULL)
  62. composition[i+j+1] = 48;
  63. d = (composition[i + j] - 48)/10;
  64. composition[i + j] -=10*d;
  65. composition[j + i + 1] +=d;
  66.  
  67. }
  68. }
  69. puts(composition);
  70. i = 0;
  71. while (composition[i] != 0)
  72. {
  73. if (composition[i] > 57)
  74. {
  75. if (composition[i+1] == NULL)
  76. composition[i+1] = 48;
  77. d = (composition[i] - 48)/10;
  78. composition[i] -=10*d;
  79. composition[i + 1] +=d;
  80. }
  81. i++;
  82. }
  83. puts(composition);
  84.  
  85.  
  86. }
Advertisement
Add Comment
Please, Sign In to add comment