Explora Libros electrónicos
Categorías
Explora Audiolibros
Categorías
Explora Revistas
Categorías
Explora Documentos
Categorías
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.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
string promedio;
notas_altas = 0;
notas_bajas = 0;
x = 70;
while (x<=70)
//Nota 1//
promedio = Console.ReadLine();
nota = int.Parse(promedio);
notas_altas = notas_altas + 1;
else
notas_bajas = notas_bajas + 1;
x = x + 1;
//Nota 2//
promedio = Console.ReadLine();
nota = int.Parse(promedio);
//Nota 3//
promedio = Console.ReadLine();
nota = int.Parse(promedio);
notas_altas = notas_altas + 1;
else
{
notas_bajas = notas_bajas + 1;
x = x + 1;
//Nota 4//
promedio = Console.ReadLine();
nota = int.Parse(promedio);
notas_altas = notas_altas + 1;
else
notas_bajas = notas_bajas + 1;
x = x + 1;
//Nota 5//
promedio = Console.ReadLine();
nota = int.Parse(promedio);
notas_altas = notas_altas + 1;
else
notas_bajas = notas_bajas + 1;
x = x + 1;
//Nota 6//
nota = int.Parse(promedio);
notas_altas = notas_altas + 1;
else
notas_bajas = notas_bajas + 1;
x = x + 1;
//Nota 7//
promedio = Console.ReadLine();
nota = int.Parse(promedio);
notas_altas = notas_altas + 1;
else
notas_bajas = notas_bajas + 1;
x = x + 1;
//Nota 8//
promedio = Console.ReadLine();
nota = int.Parse(promedio);
notas_altas = notas_altas + 1;
}
else
notas_bajas = notas_bajas + 1;
x = x + 1;
//Nota 9//
promedio = Console.ReadLine();
nota = int.Parse(promedio);
notas_altas = notas_altas + 1;
else
notas_bajas = notas_bajas + 1;
x = x + 1;
//Nota 10//
promedio = Console.ReadLine();
nota = int.Parse(promedio);
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(notas_altas);
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();
using System;
namespace Multiplo_de_2
{
class Program
{
static void Main(string[] args)
{
int numero;
if (numero % 2 == 0 )
{
Console.WriteLine("El numero ingresado es multiplo de 2 ");
}
Console.ReadKey();
}
}
}