C Program to find sum of two arrays
Program
#include<stdio.h>
void main()
{
int a[10], b[10], c[10], n, i;
printf("Enter the number of elements:\t");
scanf("%d", &n);
printf("Enter %d elements for array 1:\n", n);
for (i = 0; i < n; i++)
scanf("%d", &a[i]);
printf("Enter %d elements for array 2:\n", n);
for (i = 0; i < n; i++)
scanf("%d", &b[i]);
for (i = 0; i < n; i++)
c[i] = a[i] + b[i];
printf("Sum of two array elements are:\n");
for (i = 0; i < n; i++)
printf("%d\n", c[i]);
}
Output
Enter the number of elements: 5
Enter 5 elements for array 1:
93
37
71
03
17
Enter 5 elements for array 2:
29
84
28
75
63
Sum of two array elements are:
122
121
99
78
80