C program to merge two array

in #steemit6 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;

}


Coin Marketplace

STEEM 0.18
TRX 0.16
JST 0.031
BTC 63047.55
ETH 2690.45
USDT 1.00
SBD 2.54