hi!
any body tell me any easy matrix program which is correctly working. please.....
i am new in c#.

Here is a code:

class Class1
    {
        public static Class1 cs;
        public static int s = 0, m = 0;
        ///
        /// The main entry point for the application.
        ///
        [STAThread]
        static void Main(string[] args)
        {
            //
            // TODO: Add code to start application here
            //
            int[,] a = new int[10, 10];
            cs = new Class1();
            Console.Write("Enter the order of First Matrix : ");
            s = int.Parse(Console.ReadLine());
            Console.Write("- ");
            m = int.Parse(Console.ReadLine());
            Console.WriteLine();
            Console.WriteLine("\nEnter The value of First Matrice:");
            cs.matrice(a, s, m);
            Console.WriteLine("Matrix entered is:\n");
            cs.arrange(s);
            cs.arrange(a, s, m);
            cs.arrange(s);
            Console.WriteLine("Transpose of Matrix is :\n");
            cs.transpose(a, s, m);
            Console.ReadLine();
        }
        public void matrice(int[,] c, int k, int l)
        {
            for (int i = 0; i <= k - 1; i++)
            {
                for (int j = 0; j <= l - 1; j++)
                {
                    c[i, j] = int.Parse(Console.ReadLine());
                }
            }
        }
        public void arrange(int[,] c, int k, int l)
        {
            for (int i = 0; i <= k - 1; i++)
            {
                for (int j = 0; j <= l - 1; j++)
                {
                    Console.Write(c[i, j] + "\t");
                }
                Console.WriteLine();
            }
        }
        public void transpose(int[,] c, int s, int m)
        {
            int[,] d = new int[10, 10];
            for (int i = 0; i <= s - 1; i++)
            {
                for (int j = 0; j <= m - 1; j++)
                {
                    d[j, i] = c[i, j];
                }
            }
            cs.arrange(s);
            cs.arrange(d, m, s);
            cs.arrange(s);
        }
        public void arrange(int x)
        {
            for (int i = 0; i <= x; i++)
            {
                Console.Write("----------");
            }
            Console.WriteLine();
        }
    }

use this code...
it is working....

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

namespace New_Matrix
{
    class Program
    {
        static void Main(string[] args)
        {
            int[,] m1 ={ { 5, 4, 3 }, { 3, 2, 1 }, { 1, 1, 1 } };
            int[,] m2 ={ { 5}, { 3}, { 1 } };
            int[,] res=new int[3,1];

            for (int i = 0; i < res.GetLength(0); i++)
            {
                for (int j = 0; j < res.GetLength(1); j++)
                {
                    for (int k = 0; k < m1.GetLength(1); k++)
                    {
                        res[i, j] += m1[i, k] * m1[k, j];
                    }
                }
            }

            for (int i = 0; i < res.GetLength(0); i++)
            {
                for (int j = 0; j < res.GetLength(1); j++)
                {
                    Console.Write(res[i, j] + "\t");
                }
                Console.WriteLine();
            }
        }
    }
}
Comments
nice code
good solution
This question has already been answered. Start a new discussion instead.