How to transpose rows into columns and columns into rows in
a multi-dimensional array ?



How to transpose rows into columns and columns into rows in a multi-dimensional array ?..

Answer / kalpana

int [,]array=new int[2,2] {{1,2},{3,4}};

transpose of the array is

for(int i=0;i<2;i++)
{
for(int j=0;j<2;j++)
{
Console.Write("{0} ",a[j,i]);
}
}

o/p : 1 3
2 4

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More ASP.NET Interview Questions

What is the Global.asax used for?

7 Answers   Siebel Systems,


What do you understand from custom control?

0 Answers   C DAC, CDAC,


how can i am search the data from database? just like google

2 Answers  


Why do we need Web Services?

1 Answers   Mind Tree,


What line in the following XML document will generate an error? <?xml version=?1.0?> <employees> <employee> <name>Bob Andcarrol</name> </employee> <employee> <name>Robert Burns</name> </employee> </employees> a) 6 b) 4 c) 1 d) There is no error

3 Answers   Syntax Softtech,






Where do the cookie state and session state information be stored?

0 Answers  


What is boxing?

8 Answers   IBM, Misys, Siebel Systems,


What are the different session state management options available in asp.net?

0 Answers  


What are session and cookies?

0 Answers  


About SOAP ?

3 Answers   Cognizant, Infosys,


Define web services in asp.net.

0 Answers  


What kind of data we can store in viewstate?

0 Answers  


Categories