QUESTION
You have to merge the two sorted arrays into one sorted array (in non-increasing order)\n\nInput:\n\nFirst line contains an integer T, denoting the number of test cases.\nFirst line of each test case contains two space separated integers X and Y, denoting the size of the two sorted arrays.\nSecond line of each test case contains X space separated integers, denoting the first sorted array P.\nThird line of each test case contains Y space separated integers, denoting the second array Q.\n\n\nOutput:\n\nFor each test case, print (X + Y) space separated integer representing the merged array.
“TESTCASE_1”: “1\n4 5\n7 5 3 1\n9 8 6 2 0\n###—###SEPERATOR—###—\n9 8 7 6 5 3 2 1 0 “, “TESTCASE_2”: “2\n5 6\n8 5 3 1 0\n15 12 10 7 4 2\n4 2\n8 6 3 0\n7 1\n###—###SEPERATOR—###—\n15 12 10 8 7 5 4 3 2 1 0 \n8 7 6 3 1 0”, “TESTCASE_3”: “3\n5 5\n21 15 10 5 0\n14 12 10 9 2\n6 2\n45 12 6 5 3 0\n25 22\n10 5\n78 64 53 49 33 26 21 15 8 0\n45 31 22 10 5 \n###—###SEPERATOR—###—\n21 15 14 12 10 10 9 5 2 0 \n45 25 22 12 6 5 3 0 \n78 64 53 49 45 33 31 26 22 21 15 10 8 5 0”, “TESTCASE_4”: “0\n###—###SEPERATOR—###—\n0”, “TESTCASE_5”: “0\n###—###SEPERATOR—###—\n0
ANSWER
#include <stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n,m,i,j,a[20],b[20],c[20];
scanf("%d %d",&m,&n);
for(i=0;i<m;i++)
scanf("%d",&a[i]);
for(i=0;i<n;i++)
scanf("%d",&b[i]);
for(i=0;i<m;i++)
c[i]=a[i];
for(i=m,j=0;i<m+n;i++,j++)
c[i]=b[j];
int t=n+m;
int temp;
for(i=0;i<t;i++)
for(j=i+1;j<t;j++)
if(c[i]<c[j])
{
temp=c[i];
c[i]=c[j];
c[j]=temp;
}
for(i=0;i<m+n;i++)
printf("%d ",c[i]);
printf("\n");
}
return 0;
}