Write a program which inputs Natural numbers N and M followed by integer arrays A[] and B[], each consisting of N and M numbers of elements ...

Write a program which inputs Natural numbers N and M followed by integer arrays A[] and B[], each consisting of N and M numbers of elements respectively. Sort the arrays A[] and B[] in descending order of magnitude. Use the sorted arrays to generate a merged array C[]. Arrays C[] should be generated in descending order.

Assume the input arrays to comprise maximum 20 elements each, with no duplicates. Common elements should be should be included in the merged array only once. The output format is as follows:

Sorted Array
Merged Array
A[]        B[]              C[]
xxx        xxx            xxx
---        ---           ---
---        ---           ---
---    ---        ---
Test your program with the following data samples:
N=5    M=8
A[]    4 16 2 9 26
B[]    24 3 2 12 5 9 1 16

Have something to say? Log in to comment on this post.

0 comments