Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main(void)
- {
- int i, j, h;
- int a[] = {0, 4, 5, 9, 2, 7, 4, 9, 5, 7, 1, 6, 2, 0, 3, 0};
- int b[] = {0, 2, 7, 8, 4, 9, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
- int *result = (int *) malloc(17*sizeof(int));
- for (i = 0; i < sizeof(result); i++) {
- printf("result[i-1]");
- if (a[i] + b[i] > 9){
- result[i] = a[i] + b[i] - 10;
- result[i-1] += 1;
- }
- else{
- result[i] = a[i] + b[i];
- }
- for (j = 0; h < sizeof(result); j++) {
- if (result[j] > 9){
- result[j] -= 10;
- result[j-1] += 1;
- }
- }
- }
- printf("Result: ");
- for (h = 0; h < sizeof(result); h++) {
- printf("%d", result[h]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement