Está en la página 1de 4

PRACTICA 2 - MATRICES

1. COMPLETE LAS 12 LÍNEAS DE CÓDIGO o COMENTARIO QUE FALTA EN EL SIGUIENTE PROGRAMA


PARA QUE SE EJECUTE SIN ERRORES
static void Main(string[] args)

//TAMAÑO DE MATRIZ A

Console.Write("Inserte el Nº de Filas para la Matriz A : ");

1
int N = .................................................;

Console.Write("Inserte el Nº de Columnas para la Matriz A : ");

int M = .................................................;
2
//TAMAÑO DE LA MATRIZ B

Console.WriteLine("El Nº de Filas de la Matriz B es : {0} ", M);

Console.Write("Inserte el Nº de Columnas para la Matriz B : ");

int R = .................................................;
3
//DECLARACION DE LAS MATRICES A Y B

.......................................
4 ..........;

.................................................;
5
int[,] MatrizC = new int[N, R];

Random r = new Random();


//Llenado de datos de la Matriz A

Console.WriteLine(" \n Datos [Matriz A]: ");

for (int fil = 0; fil < N; fil++)

for (int col = 0; col < M; col++)

// Llenar la Matriz A con números aleatorios

MatrizA[fil, col] = r.Next(10);

// Mostrar la matriz en pantalla

Console.Write("| {0}\t", MatrizA[fil, col]);

Console.WriteLine();

//Llenado de datos de la Matriz B

Console. WriteLine ( "Datos [Matriz B]: " ) ;

................................................
6
{

..................................
7 ...............
{

// Llenar la Matriz B con números aleatorios

.................................................;
8

// Mostrar la matriz B en pantalla

Console.Write("| {0}\t ", MatrizB[fil, col]);

Console.WriteLine( );

}
9
//.................................................

for ( int fil = 0 ; fil <N ; fil ++ )

for ( int col = 0 ; col <R ; col ++ )

MatrizC [ fil, col ] = 0 ;

for ( int aux = 0 ; aux <M ; aux ++ )

MatrizC[ fil, col ] = MatrizA [ fil, aux ] * MatrizB [ aux, col ] + MatrizC [ fil, col ] ;

}
}
10
// ...................... ...............................
11
Console. WriteLine ( "...................(Título de la matriz resultante)......................" ) ;

for ( int fil = 0 ; fil <N ; fil ++ )

for ( int col = 0 ; col <R ; col ++ )

......................................12....................;

Console. WriteLine ( ) ;

Console.ReadKey();

2. INDIQUE, EN SUS PALABRAS, LO QUE REALIZA EL PROGRAMA.

..........................................................

También podría gustarte