Essays.club - Ensayos gratis, notas de cursos, notas de libros, tareas, monografías y trabajos de investigación
Buscar

Metodos Numericos Evidencia de la Competencia

Enviado por   •  1 de Noviembre de 2017  •  690 Palabras (3 Páginas)  •  513 Visitas

Página 1 de 3

...

Console.Read();

}

public static void Sumar_Elementos_y_promediar()

{

Double[] X = { 2, 6, -5, 10 };

Double Z = 0;

Double Varianza = 0;

for (int sumador = 0; sumador

Z += X[sumador];

Console.WriteLine();

Console.WriteLine("Suma de los elementos: {0}", Z);

Console.WriteLine();

Console.WriteLine("Media de los elementos {0}", Z / X.Length);

Console.WriteLine();

Console.WriteLine("{0,25}{1,25}{2,25}", "Elemento", "(Elemento - Media)", "(Elemento - Media2)");

for (int sumador = 0; sumador

Console.WriteLine("{0,20}{1,20}{2,25}", X[sumador], X[sumador] - (Z / X.Length), (X[sumador] - (Z / X.Length)) * (X[sumador] - (Z / X.Length)));

for (int sumador = 0; sumador

Varianza += ((X[sumador] - (Z / X.Length)) * (X[sumador] - (Z / X.Length))) / X.Length;

Console.WriteLine("Varianza: {0}", Varianza);

Console.Read();

}

}

}

[pic 2]

2.-Descomponer un numero en sus factores.

using System;

public class Factores_Numeros_Primos

{

public static void Main()

{

int numero;

int numeroprimo = 2;

Console.WriteLine();

Console.WriteLine("Ingresar numero");

Console.WriteLine();

numero = Convert.ToInt32(Console.ReadLine());

Console.WriteLine();

Console.Write(numero + " = ");

do

{ // si el resto de la division es igual a 0, se divide entre 2

while (numero % numeroprimo == 0)

{

numero = numero / numeroprimo;

Console.Write(numeroprimo);

if (numero != 1)

Console.Write(" * ");

}

numeroprimo++;

}

while (numero != 1);

Console.ReadLine();

}

}

[pic 3]

3.-Ingresando las dimensiones de 2 matrices.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace ConsoleApplication1

{

class Program

{

static void Main(string[] args)

{

int respuesta = 0;

Console.WriteLine("Cantidad de reglones");

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

Console.WriteLine("Cantidad de columnas");

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

int[,] matriz1 = new int[r, c];

Console.WriteLine("Cantidad de reglones a multiplicar");

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

Console.WriteLine("Cantidad de columnas a multiplicar");

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

int[,] matriz2 = new int[r2, c2];

if (c == r2)

{

int[,] matrizRespuestas = new int[r, c2];

//Empieza la primera matriz

for (int i = 0; i

{

for (int j = 0; j

{

Console.WriteLine("matriz 1 ingresar un valor en la posicion :{0},{1} ", i, j);

matriz1[i, j] = int.Parse(Console.ReadLine());

}

}

//Empieza la segunda matriz

Console.WriteLine("Correcto, Ingresar los valores de la segunda matriz");

for (int i = 0; i

{

for (int j = 0; j

{

Console.WriteLine("matriz 2 ingresar un valor en la posicion :{0},{1} ", i, j);

matriz2[i,

...

Descargar como  txt (6.3 Kb)   pdf (76.3 Kb)   docx (15 Kb)  
Leer 2 páginas más »
Disponible sólo en Essays.club