Está en la página 1de 6

NOMBRE COMPLETO:…………………… CÓDIGO……………..

PARALELO:………………………………

RESUMEN DE LA ASIGNATURA – EXAMEN FINAL

PROGRAMACIÓN MODULAR + LENGUAJE DE PROGRAMACIÓN C# - MODO CONSOLA O


FORMULARIOS

- Estructuras Selectivas: simples (1 alternativa), doble (2 alternativas), múltiples (>2


alternativas), anidadas.
- Estructuras Repetitivas: mientras -while (Teoria + Ejercicios), para -for (Teoría + ejercicios),
Repetir Mientras do - while(teoría). SERIES
- Estructura de Datos: Vectores, llenar, mostrar, operaciones básicas, métodos de
ordenación por intercambio – burbuja, búsqueda secuencial. SERIES

SERIES + REPETITIVAS

- Ejercicios con fórmulas:

Y 2 Y 7 Y 24
SERIE= 3!
−(X−Y ) + 9 ! −( X−Y ) + 27 ! −(X−Y ) …
X X X

- Ejercicios con secuencia de números: 1, 12, 123, 2, 23, 234, 3, 34, 345, 4,…….

SERIES + VECTORES

0 1 2 3 4 5 6 7 8 9
Y −( X−Y )
2
+Y −( X−Y )
7
+Y −( X−Y )
24

3! 9! 27 !
X X X

0 1 2 3 4 5 6 7 8 9
1 12 123 2 23 234 3 34 345 4

1. Se tiene el siguiente vector de 10 elementos:

0 1 2 3 4 5 6 7 8 9
10 1 20 1 3 30 1 4 7 40
a) Generar
b) Mostrar el vector desordenado y ordenado
c) Ordenar de forma descendente

0 1 2 3 4 5 6 7 8 9
10 1 20 1 3 30 1 4 7 40

10 11 12 13 14 15 16 17 18 19
1 5 9 13 50 1 6

a) Generar
b) Mostrar: Desordenado/Ordenado
c) Ordenar de forma descendente

0 1 2 3 4 5 6 7 8 9
40 30 20 10 7 4 3 1 1 1

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp14
{
class Program
{
static void Main(string[] args)///pp
{
int[] vector = new int[10];
GENERAR(vector);//PROCEDIMIENTO
MOSTRAR(vector); //PROCEDIMIENTO
Console.WriteLine();
Console.WriteLine("......... VECTOR ORDENADO.......");
Console.WriteLine();
ORDENAR(vector); // PROCEDIMIENTO
MOSTRAR(vector); // PROCEDIMIENTO
Console.ReadKey();
}
static void GENERAR(int[] vector)
{
int indice = 0, p = 0, inc = 0, d = 10, x, cr;
while (indice <= 9)
{
vector[indice] = d;
d = d + 10;
indice++;
x = 1;
inc = inc + 1;
p = p + 1;
cr = 1;
while (cr <= p && indice <= 9)
{
vector[indice] = x;
x = x + inc;
indice++;
cr = cr + 1;
}

}
}
static void ORDENAR(int[] vector)
{
int aux;
for (int i=0; i<=8; i++)
{
for (int j=0; j<=8; j++)
{
if (vector[j]< vector[j+1])
{
aux = vector[j];
vector[j] = vector[j + 1];
vector[j + 1] = aux;

}
}
}

}
static void MOSTRAR(int[] vector)
{
for (int indice = 0; indice <= 9; indice++)
{
Console.WriteLine("[ " + indice + " ] = " + vector[indice]);
}
}
}
}

SERIES + VECTORES

0 1 2 3 4 5
Y −( X−Y )
2
+Y −( X−Y )
7
+Y −( X−Y )
24

3! 9! 27 !
X X X

Y 2 Y 7 Y 24
SERIE= 3!
−(X−Y ) + 9 ! −( X−Y ) + 27 ! −( X−Y )
X X X
a) Generar la serie tomando en cuenta que el vector tiene 6 elementos, X, Y son números
naturales ingresados por el usuario.
b) Mostrar el vector
c) Ordenar de forma descendente
d) Cual es el valor mayor y menor del vector

A=3; A=A*3;

C=1

B= A-C

C=C+1

0 1 2 3 4 5
Y −( X−Y ) B
+Y −( X−Y ) B
+Y −( X−Y )B
A! A! A!
X X X

A! ESO SERÁ EL RESULTADO QUE ME DE UNA FUNCIÓN: RFACTORIAL=FACTORIAL(A)

0 1 2 3 4 5
Y −( X−Y ) B
+Y −( X−Y ) B
+Y −( X−Y )B
RFACTORIAL RFACTORIAL RFACTORIAL
X X X
RFACTORIAL
X ESTO SERÁ EL RESULTADO QUE ME DE OTRA FUNCIÓN: REXPONENTE=EXPONENTE(X, RFACTORIAL)

0 1 2 3 4 5
Y −( X−Y ) B
+Y −( X−Y ) B
+Y −( X−Y )B
RFACTORIAL RFACTORIAL RFACTORIAL
X X X

RFACTORIAL
X ESTO SERÁ EL RESULTADO QUE ME DE OTRA FUNCIÓN: REXPONENTE=EXPONENTE(X, RFACTORIAL)

0 1 2 3 4 5
Y −( X−Y )B +Y −( X−Y )B +Y −( X−Y )B
REXPONENTE REXPONENTE REXPONENTE

(X −Y )B esto será el resultado de la función: REXPONENTE=EXPONENTE((X-Y), B)


0 1 2 3 4 5
Y −REXPONENTE +Y −REXPONENTE +Y −REXPONENTE
REXPONENTE REXPONENTE REXPONENTE

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GENERARVECTOR
{
class Program
{
static void Main(string[] args)//PP
{
GENERAR();//PROCEDIMIENTO a)
Console.ReadKey();
}//FIN PP
static void GENERAR()//a)
{
double[] VECTOR = new double[6]; // declaración del vector
llenar(VECTOR);//PROCEDIMIENTO
MOSTRAR(VECTOR);//PROCEDIMIENTO
ORDENAR(VECTOR); //PROCEDIMIENTO
MAYORMENOR(VECTOR);//PROCEDIMIENTO

}
static void llenar(double[] vector)
{
double X, Y, A=3, B, C=1,termino; //deben ser número naturales
double REXPONENTE, RFACTORIAL;
double RESTA;
Console.Write("INGRESE UN NÚMERO NATURAL");
X = double.Parse(Console.ReadLine());
Console.Write("INGRESE OTRO NÚMERO NATURAL");
Y = double.Parse(Console.ReadLine());
if (X>=1 && Y>=1)
{
for(int indice=0; indice<=5; indice++)//controla el vector
{
B = A - C;
if (indice%2==1)//impar
{
RESTA = X - Y;
REXPONENTE = EXPONENTE(RESTA, B);
C = C + 1;
termino = -REXPONENTE;
vector[indice] = termino;

}
else//par incluye al cero
{
RFACTORIAL = FACTORIAL(A);
REXPONENTE = EXPONENTE(X, RFACTORIAL);
termino = Y / REXPONENTE;
vector[indice] = termino;
A = A * 3;
}
}
}
else
{
Console.WriteLine("no se puede generar");
}

}//llenar
static double EXPONENTE(double num1, double num2)
{
double t = 1;
for (int vc=1; vc<=num2; vc++)
{
t = t * num1;
}
return t;
}
static double FACTORIAL(double A)
{
double t = 1;
for (int vc = 1; vc <= A; vc++)
{
t = t * vc;
}
return t;
}
static void MOSTRAR(double[] vector)
{
for (int indice=0; indice<=4; indice++)
{
Console.WriteLine("[ " + indice + " ] = "+ vector[indice]);
}
}
static void ORDENAR(double[] vector)
{
double aux; // vector.length permite obtener el tamaño del vector
for (int i=0; i<=4; i++)
{
for (int j=0; j<=4; j++)
{
if (vector[j]<vector[j+1])// descendente
{
aux = vector[j];
vector[j] = vector[j+1];
vector[j + 1] = aux;
}
}
}
}
static void MAYORMENOR(double[] vector)
{
Console.WriteLine("MAYOR");
Console.WriteLine("[ " + 0 + " ] = " + vector[0]);
Console.WriteLine("MENOR");
Console.WriteLine("[ " + 5 + " ] = " + vector[5]);
}
}
}

También podría gustarte