Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transpose of a matrix created by Rojarani #524

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions 2022-Oct/18 Oct 2022/rojarani_akkisetty.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/// C# Program to Print the Transpose of a Given Matrix

using System;

namespace Program
{
class MatrixTranspose
{
public static void Main(string[] args)
{
int m, n, i, j;

Console.Write("Enter the Order of the Matrix : ");
m = Convert.ToInt16(Console.ReadLine());
n = Convert.ToInt16(Console.ReadLine());
int[,] A = new int[m, n];

Console.Write("\nEnter The Matrix Elements : ");
for (i = 0; i < m; i++)
for (j = 0; j < n; j++)
A[i, j] = Convert.ToInt16(Console.ReadLine());

Console.WriteLine("\nGiven Matrix : ");
for (i = 0; i < m; i++)
{
for (j = 0; j < n; j++)
Console.Write(A[i, j] + " ");
Console.WriteLine();
}

Console.WriteLine("\nTranspose Matrix : ");
for (i = 0; i < m; i++)
{
for (j = 0; j < n; j++)
Console.Write(A[j, i] + " ");
Console.WriteLine();
}
}
}
}