Tuesday, 27 November 2012

Transpose Matrix

using System;
using System.Collections.Generic;
using System.Text;

namespace transpose_matrix
{
class mat
{
int[,] a = new int[20, 20];
int i,j,n,m;
public void get()
{
Console.WriteLine("TRANSPOSE MATRIX");
Console.WriteLine("*****************");
Console.WriteLine("Enter the Row Value");
n = int.Parse(Console.ReadLine());
Console.WriteLine("Enter the Column Value");
m = int.Parse(Console.ReadLine());
Console.WriteLine("Enter The Elements One by One");
for (i = 1; i <= n; i++)
{
for (j = 1; j <= m; j++)
{
a[i, j] = new int();
a[i, j] = int.Parse(Console.ReadLine());
}
}
Console.WriteLine("Given Matrix");
for (i = 1; i <= n; i++)
{
for (j = 1; j <= m; j++)
{
Console.Write("{0}\t", a[i, j]);
}
Console.WriteLine();
}
}
public void cal()
{
Console.WriteLine("TRANSPOSE MATRIX");
for (i = 1; i <= m; i++)
{
for (j = 1; j <= n; j++)
{
Console.Write("{0}\t", a[j, i]);
}
Console.WriteLine();
}
}
}

class transpose
{
static void Main(string[] args)
{
mat q = new mat();
q.get();
q.cal();

}
}
}

1 comment:

  1. Can you please post a picture of the GUI form of this C# program?

    ReplyDelete