From d7107ab44dd2c330b54867fd9d36d9754c9bc5e6 Mon Sep 17 00:00:00 2001 From: Rozza <59175124+rozza7@users.noreply.github.com> Date: Sat, 29 Oct 2022 00:14:28 +0530 Subject: [PATCH] Transpose of a matrix created by Rojarani --- 2022-Oct/18 Oct 2022/rojarani_akkisetty.cs | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 2022-Oct/18 Oct 2022/rojarani_akkisetty.cs diff --git a/2022-Oct/18 Oct 2022/rojarani_akkisetty.cs b/2022-Oct/18 Oct 2022/rojarani_akkisetty.cs new file mode 100644 index 0000000..4602e6e --- /dev/null +++ b/2022-Oct/18 Oct 2022/rojarani_akkisetty.cs @@ -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(); + } + } + } +} \ No newline at end of file