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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

How can you register a custom server control to a web page?

743


What are the different types of sessions in asp.net?

679


Can you set which type of comparison you want to perform by the comparevalidator control?

700


What is asp.net version?

701


Explain http handlers? Where we can use the http handlers?

931


What is the difference between a candidate key and primary key?

736


How can we make sure that Web API returns JSON data only?

750


Explain what are the advantages of asp.net mvc framework? : asp.net mvc

721


How to disable validator control by client side JavaScript?

748


What is difference between singleton and single call?

819


What is the main differences between asp and asp.net?

727


How to create events for a control?

750


Contrast OOP and SOA. What are tenets of each ?

1939


Can I combine classic asp and asp.net pages?

712


What are the differences between the response.write() and response.output.write()?

752