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

Answer Posted / venugopal

//Here 'i' indicates for 'i'th row and 'j' indicates
for 'j'th row
//Thus, the matrix is iXj with 3X2 size
//The result matrix should be 2X3

//The logic is as fallows

for(int j=0;j<2;J++)
{
for(int i=0;i<3;i++)
console.write(a[j,i]);
//After completing the first row it should be in the
next line
console.writeln("\n");
}

The final out put should be

2 1 3
2 2 4

Is This Answer Correct ?    8 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

For methods inside the interface why can’t you specify the accessibility modifier?

543


Please explain value types and reference types used in c#?

468


Does constructor return any value in c#?

490


Is string mutable in c#?

476


Difference between Value type & reference types ? and give the example in .Net?

515






What is mvc in c#?

457


What is the advantage of dependency injection?

490


List the 5 different access modifiers in c#?

502


What is type checking in c#?

501


What is form feed and carriage return?

469


What is dictionary class in c#?

466


Explain the accessibility modifier protected internal?

452


What is the symbol used for in c#?

486


How do I develop c# apps?

516


What are the fundamental principles of oo programming?

491