Question: 4. find all the pairs whose sum is equal to a given number in an unsorted array? List _l=new List (); arrayList _a=new AerrayList(){1,2,3,4,5,6,4,7}; ArrayList

4. find all the pairs whose sum is equal to a given number in an unsorted array?

List _l=new List();

arrayList _a=new AerrayList(){1,2,3,4,5,6,4,7};

ArrayList _b=_a;

foreach(int _i in _a)

foreach(int _j in _b)

if(_i+_j==9)

_l.Add(new pairData(){A=_i,B=_j});

foreach(var _item in _l)

Console.WriteLine("{0},{1}",_item.A,item.B);

####################

class pairData{

public int A{get;set;}

public int B{get;set;}

}

write in javascript

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!