C program to merge two array

in #steemit7 years ago (edited)

Array is the collection of same type of data elements. In this blog we will learn to merge two array of same size named as a & b in a single array c.

          

Program :


#include< stdio.h>

#include<conio.h>

int main()

{

int a[50],b[50],c[100],i,n,j,m;

printf("Enter the value of n and m :");

scanf("%d%d",&m,&n);

printf("Enter the value of array :\n");

for(i=0;i<n;i++)

{

scanf("%d",&a[i]);

}

for(i=0;i<m;i++)

{

scanf("%d",&m);

}

j=0;

for(i=-;i<n;i++)

{

c[j]=a[i];

printf("%d",a[i]);

j++;

}

for(i=0;i<m;i++)

{

c[j]=b[i];

printf("%d",b[i]);

j++;

}

retrun 0;

}