in C programming (code) how to add 2 arrays with different sizes and retain extra elements of larger array using functions. kindly share me the code ??? sample input and output: input:5 2 1 3 6 and 1 2 3 output:6 4 4 3 6 plzzzz ans fast ,very urgent copy the code and paste me ,...
hello JJ
I hope you are doing good. I would like to share the code below by assuming that you have tried your best and still not able to get logic
int main()
{
int arr1[5]={5,2,1,3,6};
int arr2[3]={1,2,3};
int arr3[5];
for(i=0;i<(sizeof(arr2)/sizeof(int));i++)
{
arr3[i]=arr1[i]+arr2[i];
}
//cout<<&arr[0];
for(;i<(sizeof(arr1)/sizeof(int));i++)
{
arr3[i]=arr1[i];
}
for(int i=0;i<(sizeof(arr1)/sizeof(int));i++)
cout<<arr3[i];
}
Hope you found this answer helpful,good luck for your future
thankyou




