Professional Documents
Culture Documents
using
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
System.Threading.Tasks;
namespace FUNCIONES1
{
class Program
{
public static void letra()
{
string word;
Console.WriteLine("Escriba una palabra: ");
word = Console.ReadLine();
Console.WriteLine("{0}", word[word.Length-1]);
Console.ReadLine();
}
static void Main(string[] args)
{
letra();
}
}
}
using
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
System.Threading.Tasks;
namespace FUNCIONES2
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Ingrese un numero");
int A = Convert.ToInt16(Console.ReadLine());
Console.WriteLine("Ingrese un numero");
int B = Convert.ToInt16(Console.ReadLine());
Console.WriteLine("Ingrese un numero");
int C = Convert.ToInt16(Console.ReadLine());
if(A > B && A > C){
Console.WriteLine("El numero mayor es "+A);
}else{
if(B > A && B > C){
Console.WriteLine("El numero mayor es "+B);
}else{
VECTORES
1) Programa que te ordene de menor a mayor con vectores.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VECTOR1
{
class Program
{
static void Main(string[] args)
{
int[] vector = new int[10];
for (int i = 0; i < 10; i++)
{
Console.Write("Elemento {0}: ", i + 1);
vector[i] = Int32.Parse(Console.ReadLine());
}
for (int i = 0; i < 10; i++)
Console.Write("{0} ", vector[i]);
Console.ReadLine();
}
}
}
2) Hacer una aplicacin que entre una serie de valores numricos desde el teclado, los
almacene en un vector y sume los elementos de las posiciones pares, lo mismo que las
posiciones impares por separados.
MATRICES
1) Hacer un programa que te dibuje una matriz.
using
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
System.Threading.Tasks;
namespace MATRIZ1
{
class Program
{
static void Main(string[] args)
{
Console.Write("Tamanio de matriz: ");
int tam = int.Parse(Console.ReadLine());
int[,] matriz = new int[tam, tam]; //matriz 3 x 3
int cont = 1;
//Llenado de matriz
for (int i = 0; i < tam; i++)
for (int j = 0; j < tam; j++)
matriz[i, j] = cont++;
//Impresion
for (int i = 0; i < tam; i++)
{
for (int j = 0; j < tam; j++)
Console.Write(string.Format("{0,4:D}", matriz[i, j]));
Console.WriteLine();
}
Console.ReadKey();
}
}
}