write a program to accept elements in two single dimension 2D array and them into third array
/*program to accept elements in two single dimension 2D array
and add them into third array */
# include<stdio.h>
main()
{
int arr1[5], arr2[5], arr3[5];
int i=0;
printf("\n Enter elements for first array");
for(i=0;i<=4;i++) // First for loop to accept first array elements.
{
printf("\nEnter number:");
scanf("%d",&arr1[i]);
}
printf("\n Enter elements for second array");
for(i=0;i<=4;i++) // Second for loop to accept second array elements
{
printf("\nEnter number:");
scanf("%d",&arr2[i]);
}
printf("\n addition stored in third array");
for(i=0;i<=4;i++) // Third for loop to add elements of array into third.
{
arr3[i]=arr1[i]+arr2[i]; // Putting added elements of arr1 and arr2 into arr3 at ith location.
printf("\n arr3[%d]=%d ",i, arr3[i]);
}
getch();
}