ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

Multipicacion De Matrices En C#


Enviado por   •  9 de Abril de 2013  •  2.481 Palabras (10 Páginas)  •  476 Visitas

Página 1 de 10

Tabla de contenido

MULTIPLICACION DE MATRICES 3

Conclusiones 9

MULTIPLICACION DE MATRICES

El producto de dos matrices se puede definir sólo si el número de columnas de la matriz izquierda es el mismo que el número de filas de la matriz derecha.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace multiplicacionMatrizes

{

class Program

{

static void Main(string[] args)

{

Console.WriteLine(" Alumna: Eunice Nayely Vazquez Torres ");

Console.WriteLine(" Numero de Control: 12410905 ");

Console.WriteLine(DateTime.Now);

Console.WriteLine();

Console.WriteLine("MULTIPLICACION DE MATRICES ");

Console.WriteLine();

//MATRIZZ [1]

Console.WriteLine("Matriz 1");

Console.Write("Inserte el Nº de Filas: ");

int f1 = int.Parse(Console.ReadLine());

Console.Write("Inserte el Nº de Columnas: ");

int c1 = int.Parse(Console.ReadLine());

//MATRIZZ [2]

Console.WriteLine("\n Matriz 2");

Console.Write("Inserte el Nº de Filas: ");

int f2 = int.Parse(Console.ReadLine());

Console.Write("Inserte el Nº de Columnas: ");

int c2 = int.Parse(Console.ReadLine());

//DECLARACION DE LAS MATRICES 1 Y 2

//Las filas y columnas se suman +1 para empezar desde posicion 1

int[,] Matriz1 = new int[f1 + 1, c1 + 1];

int[,] Matriz2 = new int[f2 + 1, c2 + 1];

int[,] Multiplicacion = new int[f1 + 1, c2 + 1];

//CONDICIONES

//Si la columna de la matriz 1 es igual al número de filas de la matriz 2

if (c1 == f2)

{

//Empezando a llenar la Matriz 1

{

Random aleatorio = new Random();

for (int i = 0; i < Matriz1.GetLength(0); i++)

{

for (int j = 0; j < Matriz1.GetLength(1); j++)

{

Matriz1[i, j] = aleatorio.Next(0, 16);

}

}

}

//Empezando a llenar las Matriz 2

Random aleatorio2 = new Random();

for (int i = 0; i < Matriz2.GetLength(0); i++)

{

for (int j = 0; j < Matriz2.GetLength(1); j++)

{

Matriz2[i, j] = aleatorio2.Next(0, 16);

}

}

...

Descargar como (para miembros actualizados)  txt (6.2 Kb)  
Leer 9 páginas más »
Disponible sólo en Clubensayos.com