//Merge a Array at last of Another Array
#include<iostream.h>
#include<conio.h>
main()
{
int a[10],b[10];
int m,n,i;
cout<<"Enter size of array A & B";
cin>>m>>n;
cout<<"Enter Elements of A";
for(i=0;i<m;i++)
cin>>a[i];
cout<<"Enter elements of B";
for(i=0;i<n;i++)
cin>>b[i];
for(i=0;i<n;i++)
a[m+i]=b[i];
//printing
for(i=0;i<m+n;i++)
cout<<a[i]<<" ";
getch();
}
#include<iostream.h>
#include<conio.h>
main()
{
int a[10],b[10];
int m,n,i;
cout<<"Enter size of array A & B";
cin>>m>>n;
cout<<"Enter Elements of A";
for(i=0;i<m;i++)
cin>>a[i];
cout<<"Enter elements of B";
for(i=0;i<n;i++)
cin>>b[i];
for(i=0;i<n;i++)
a[m+i]=b[i];
//printing
for(i=0;i<m+n;i++)
cout<<a[i]<<" ";
getch();
}
No comments:
Post a Comment