Write the code which gets two equal size integer arrays and number of elements as parameters and calculates and displays the sum of parallel elements of both arrays in C language? Size of the array and elements of the array have to be given by the user
#include <stdio.h>
int main()
{
int n, i;
printf("Enter size of array \n");
scanf("%d", &n);
int arr1[n], arr2[n], sum[n];
for(i = 0; i < n; i++)
{
printf("enter number %d for array 1 ", i+1);
scanf("%d", &arr1[i]);
}
for(i = 0; i < n; i++)
{
printf("enter number %d for array 2 ", i+1);
scanf("%d", &arr2[i]);
}
for (i=0; i<n; i++)
{
sum[i]=arr1[i]+arr2[i];
}
printf("The total is ");
for (i=0; i<n; i++)
printf(" %d " , sum[i]);
return 0;
}