All Programs are Written and Compiled in Dev C++. So, it may generate some error in case of other compilers and may need some modifications in program. Download Dev C++

Wednesday 26 February 2014

Merge a Array at last of Another Array

//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();
 }

No comments:

Post a Comment