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

Answer Posted / raji

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 ?    20 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between gridview and form view?

540


What is boxing in c#?

556


How can I develop an application that automatically updates itself from the web?

480


List down the commonly used types of exceptions in .net

496


What is xamarin used for?

510






What is the process of delegation?

495


What are the different types of delegation?

443


What is session c#?

535


What is the use of GC.KeepAlive Method?

647


Can main method be final?

474


What is null propagation c#?

508


What is void method?

491


What is xpath in c#?

485


What are All kind of access specifiers for a class and for methods

558


What does it mean to override a method?

469