write a program for finding the union of two integer array
in java?

Answer Posted / nadeem khokhar

the above mentioned code is also good one. but i m giving you an algorithm you can say, so you can get the concept and convert it into any language
int a[3]=1,2,3;
int b[3]=2,3,4;

for(int i=0; i <=2; i++)
{

for(int j=0; j<=2; j++)
{

if(a[i] == b[j])
cout<<a[i]; is a union of a and b
}
}

Is This Answer Correct ?    14 Yes 26 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How does the type system works when there is interoperability between a COM and .Net, i mean what exactly happens there

1566


why we use mantis? what u mean mantis in IT trends? addvantages of mantis?

1738


hii I inntrested abt scjp certification but i dont knw abt scjp plz send details abt scjp exam and syllabus.

1390


Given n red balls and m blue balls and some containers, how would you distribute those balls among the containers such that the probability of picking a red ball is maximized, assuming that the user randomly chooses a container and then randomly picks a ball from that.

585


define profiler???

1603






< DL Compact > tag is used for

1545


What is the difference between COM and CORBA?

725


Given an array of size n. It contains numbers in the range 1 to n. Each number is present at least once except for 1 number. Find the missing number

727


how to get second highest salary from a employee table and how get a 5th highest salary from a employee table by using proc sql?

1889


1. How many jobs can we write in a single file? 2. How many maximum members can exist in a single partition data set(pds) in jcl?

1916


what is the use of occurs 10 or (any number) in the internal table declaration with header line.

1466


MOV.CB 007H,ADCON1 MOVE.CT 001H,_OPTION_REG_7 MOV.CB 007H,CMCON

1628


how much fee for deccan soft institute .how to block seat for sandeep sir class reply soonnnn 

1652


SAS question: I have 50 fils a1,a2,...,a50. the primary key is upc. then if i want to merge all 50 files, the code is as follows, data test; merge a1 ... a50; by upc; run; we know that writing all 50 files name is time consuming, is there any standard format of this code?

1511


Hi I am Rathnam, How To Remove the duplicates with out using remove duplicate stage in the datastage

1522