Está en la página 1de 8

1.

CREAR UN PROGRAMA QUE LEA 5 NUMEROS DESDE TECLADO Y PRESENTE LA SUMATORIA DE LOS
MISMOS. HACER USO DE LA ESTRUCTURA REPETITIVA WHILE.

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

namespace EstructuraRepetitivaWhile3
{
class Program
{
static void Main(string[] args)
{
int x, suma, valor;
string linea;
x = 1;
suma = 0;
while (x <= 5)
{
Console.Write("Ingrese un valor:");
linea = Console.ReadLine();
valor = int.Parse(linea);
suma = suma + valor;
x = x + 1;
}

Console.Write("La suma de los 10 valores es:");


Console.WriteLine(suma);

Console.ReadKey();
}
}
}

2. ESCRIBIR UN PROGRAMA QUE LEA 10 NOTAS DE ALUMNOS Y NOS INFORME CUANTOS TIENEN NOTAS
MAYORES O IGUAL A 70 Y CUANTOS MENORES

using System;

namespace ConsoleApp14

class Program

static void Main(string[] args)

int notas_altas, notas_bajas, x, nota;

string promedio;
notas_altas = 0;

notas_bajas = 0;

x = 70;

while (x<=70)

//Nota 1//

Console.Write(" Ingrese la nota 1: ");

promedio = Console.ReadLine();

nota = int.Parse(promedio);

if (nota >= 70)

notas_altas = notas_altas + 1;

else

notas_bajas = notas_bajas + 1;

x = x + 1;

//Nota 2//

Console.Write(" Ingrese la nota 2: ");

promedio = Console.ReadLine();

nota = int.Parse(promedio);

//Nota 3//

Console.Write(" Ingrese la nota 3: ");

promedio = Console.ReadLine();

nota = int.Parse(promedio);

if (nota >= 70)

notas_altas = notas_altas + 1;

else
{

notas_bajas = notas_bajas + 1;

x = x + 1;

//Nota 4//

Console.Write(" Ingrese la nota 4: ");

promedio = Console.ReadLine();

nota = int.Parse(promedio);

if (nota >= 70)

notas_altas = notas_altas + 1;

else

notas_bajas = notas_bajas + 1;

x = x + 1;

//Nota 5//

Console.Write(" Ingrese la nota 5: ");

promedio = Console.ReadLine();

nota = int.Parse(promedio);

if (nota >= 70)

notas_altas = notas_altas + 1;

else

notas_bajas = notas_bajas + 1;

x = x + 1;

//Nota 6//

Console.Write(" Ingrese la nota 6: ");


promedio = Console.ReadLine();

nota = int.Parse(promedio);

if (nota >= 70)

notas_altas = notas_altas + 1;

else

notas_bajas = notas_bajas + 1;

x = x + 1;

//Nota 7//

Console.Write(" Ingrese la nota 7: ");

promedio = Console.ReadLine();

nota = int.Parse(promedio);

if (nota >= 70)

notas_altas = notas_altas + 1;

else

notas_bajas = notas_bajas + 1;

x = x + 1;

//Nota 8//

Console.Write(" Ingrese la nota 8: ");

promedio = Console.ReadLine();

nota = int.Parse(promedio);

if (nota >= 70)

notas_altas = notas_altas + 1;

}
else

notas_bajas = notas_bajas + 1;

x = x + 1;

//Nota 9//

Console.Write(" Ingrese la nota 9: ");

promedio = Console.ReadLine();

nota = int.Parse(promedio);

if (nota >= 70)

notas_altas = notas_altas + 1;

else

notas_bajas = notas_bajas + 1;

x = x + 1;

//Nota 10//

Console.Write(" Ingrese la nota 10: ");

promedio = Console.ReadLine();

nota = int.Parse(promedio);

if (nota >= 70)

notas_altas = notas_altas + 1;

else

notas_bajas = notas_bajas + 1;

x = x + 1;
if (nota >= 70)

notas_altas = notas_altas + 1;

else

notas_bajas = notas_bajas + 1;

x = x + 1;

Console.WriteLine("Alumno con notas mayor o igual a 70 ");

Console.WriteLine(notas_altas);

Console.WriteLine("Alumno con notas menor o igual a 70 ");

Console.WriteLine(notas_bajas);

Console.ReadKey();

}
3. UN PROGRAMA QUE PUEDA RECORRER LOS NUMEROS DEL 1 AL 100. USAR UN BUCLE FOR.

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

namespace ConsoleApp16
{
class Program
{
static void Main(string[] args)
{
for (int x = 1; x <= 100; x++)
Console.Write(x + "\t");
Console.ReadKey();
}
}
}

4. UN PROGRAMA QUE CAPTURE NOMBRE Y APELLIDO POR SEPARADO Y LUEGO LOS MUESTRE EN UNA
MISMA LINEA.

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

namespace ConsoleApp18
{
class Program
{
static void Main(string[] args)
{
//Console.WriteLine("Escribe tu nombre:");
Console.Write("Escribe tu nombre: ");
string nombre = Console.ReadLine();

//Console.WriteLine("Escribe tu apellido:");
Console.Write("Escribe tu apellido: ");
String apellido = Console.ReadLine();

Console.WriteLine("Bienvenido {0}, {1}", nombre, apellido);


Console.ReadKey();
}
}
}
5. CREAR UN PROGRAMA QUE PIDA AL USARIO UN NUMERO ENTERO Y RESPONDA SI ES MULTIPLO DE 2.

using System;

namespace Multiplo_de_2
{
class Program
{
static void Main(string[] args)
{
int numero;

Console.WriteLine("Ingrese numero entero: ");


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

if (numero % 2 == 0 )
{
Console.WriteLine("El numero ingresado es multiplo de 2 ");
}
Console.ReadKey();
}
}
}

También podría gustarte