01/11/2015

Write A Program To Merge Two Array In Third Array Unconditionally

#include <iostream>
#include<string.h>
#include<cstdlib>
using namespace std;
main ()
{
int s1,s2,a[100],b[100],i;
cout<<"Enter the size of Array 1\n\n";
cin>>s1;
cout<<"Enter the first Element of array\n\n";
for(i=0;i<s1;i++)
{
cin>>a[i];
}

cout<<"Enter the size of Array 2\n\n";
cin>>s2;
cout<<"Enter the Second Element of array\n\n";
for(i=s1;i<s2+s1;i++)
{
cin>>a[i];
}

cout<<"Merge array Are Given Below\n\n";
for(i=0;i<s1+s2;i++)
{
cout<<a[i]<<" ";
}

}

Output:-


Previous Post
Next Post

post written by:

Hi, I’m Ghanendra Yadav, SEO Expert, Professional Blogger, Programmer, and UI Developer. Get a Solution of More Than 500+ Programming Problems, and Practice All Programs in C, C++, and Java Languages. Get a Competitive Website Solution also Ie. Hackerrank Solutions and Geeksforgeeks Solutions. If You Are Interested to Learn a C Programming Language and You Don't Have Experience in Any Programming, You Should Start with a C Programming Language, Read: List of Format Specifiers in C.
Follow Me

0 Comments: