Está en la página 1de 6

1.

INICIO
Enteros dia, mes, a
Escribir “INGRESE DIA”

Leer dia

Escribir “INGRESE MES”

Leer mes

Escribir “INGRESE AÑO”

Leer a

Si (dia > 0 && (mes <= 12 && mes > 0) && a > 0 && dia<32)
Cambiar
Caso 1:
Si (dia <= 31)
Escribir “fecha correcta”
.
.
.
Caso 2:
Si (dia <=29 && a % 4 == 0 && a % 100 != 0 || a % 400 == 0 )
Escribir “FECHA CORRECTA”
Caso contario
Escribir “FECHA INCORRECTA”
Caso contrario
Escribir “FECHA INCORRECTA”
FIN

int dia, mes, a;

Console.WriteLine("INGRESE DIA");
dia = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("INGRESE MES");
mes = Convert.ToInt32(Console.ReadLine());

Console.WriteLine("INGRESE AÑO");
a = Convert.ToInt32(Console.ReadLine());

if (dia > 0 && (mes <= 12 && mes > 0) && a > 0 && dia<32
)
{
switch (mes)
{
case 1:
if (dia <= 31)
Console.WriteLine(dia + " de enero del " + a + "
FECHA CORRECTA ");
break;

case 3:
if (dia <= 31)
Console.WriteLine(dia + " de marzo del " + a + "
FECHA CORRECTA ");
break;
case 4:
if (dia <= 30)
Console.WriteLine(dia + " de abril del " + a + "
FECHA CORRECTA ");
break;
case 5:
if (dia <= 31)
Console.WriteLine(dia + " de mayo del " + a + " FECHA
CORRECTA ");
break;
case 6:
if (dia <= 30)
Console.WriteLine(dia + " de junio del " + a + "
FECHA CORRECTA ");
break;
case 7:
if (dia <= 31)
Console.WriteLine(dia + " de julio del " + a + "
FECHA CORRECTA ");
break;
case 8:
if (dia <= 31)
Console.WriteLine(dia + " de agosto del " + a + "
FECHA CORRECTA ");
break;

case 9:
if (dia <= 30)
Console.WriteLine(dia + " de septiembre del " + a + "
FECHA CORRECTA ");
break;

case 10:
if (dia <= 31)
Console.WriteLine(dia + " de octubre del " + a + "
FECHA CORRECTA ");
break;
case 11:
if (dia <= 30)
Console.WriteLine(dia + " de noviembre del " + a + "
FECHA CORRECTA ");
break;

case 12:
if (dia <= 31)
Console.WriteLine(dia + " de diciembre del " + a + "
FECHA CORRECTA ");
break;

case 2:
if (dia <=29 && a % 4 == 0 && a % 100 != 0 || a % 400 ==
0 )
Console.WriteLine(dia + " de febrero del " + a + "
FECHA CORRECTA ");

else

Console.WriteLine("FECHA INCORRECTA ");


break;

}
}

else
Console.WriteLine("FECHA INCORRECTA");

Console.Read();

2. Escriba un programa que permita leer notas válidas y el grupo A1 y A2 de n alumnos


y reportar:
a) Cantidad de alumnos aprobados del grupo A2
b) Nota promedio de grupo A1.
c) Nota promedio de los n alumnos.
INICIO
Enteros aprob2 =0, n, i, a1=0, a2=0;
Decimales notapromedio1, nota, sumanota1=0, sumanota2=0, prom_total, sn;
String grupo;

Escribir “INGRESE CANTIDAD DE ALUMNOS”

Leer grupo

Para (i = 1; i <= n; i++)

Escribir “INGRESE EL GRUPO DEL ALUMNO”

Leer a

Switch(grupo)

Caso A1:
Hacer

Escribir “INGRESE NOTA DEL ALUMNO”

Leer nota

Mientras ((nota > 20) || (nota < 0));


sumanota1 = sumanota1 + nota;
a1++;

Caso A2:
Hacer

Escribir “INGRESE NOTA DEL ALUMNO”

Leer nota

Mientras ((nota > 20) || (nota < 0));


sumanota2 = sumanota2 + nota;

If (nota >= 11)


aprob2 = aprob2 + 1;
a2++;

notapromedio1 = sumanota1 / a1;


sn = sumanota1 + sumanota2;
prom_total = sn / n;

Escribir ("cantidad de Alumnos aprobados del grupo A2: " + aprob2)


Escribir ("NOTA PROMEDIO DEL GRUPO A1: " + notapromedio1)
Escribir ("NOTA PROMEDIO DE TODOS LOS ALUMNOS: " + prom_total)
FIN
-CODICO C#
int aprob2 =0, n, i, a1=0, a2=0;
double notapromedio1, nota, sumanota1=0, sumanota2=0, prom_total, sn;
string grupo;

Console.WriteLine("INGRESE CANTIDAD DE ALUMNOS");


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

for (i = 1; i <= n; i++)


{
Console.WriteLine("INGRESE EL GRUPO DEL ALUMNO " + i + ":");
grupo = Console.ReadLine();

switch (grupo)
{
case "A1":
do
{
Console.WriteLine("INGRESE NOTAS DEL ALUMNO " + i +
":");
nota = Convert.ToDouble(Console.ReadLine());
}
while ((nota > 20) || (nota < 0));
sumanota1 = sumanota1 + nota;
a1++;

break;

case "A2":
do
{
Console.WriteLine("INGRESE NOTAS DEL ALUMNO " + i +
":");
nota = Convert.ToDouble(Console.ReadLine());
}
while ((nota > 20) || (nota < 0));

sumanota2 = sumanota2 + nota;

if (nota >= 11)


aprob2 = aprob2 + 1;
a2++;
break;

}
}

notapromedio1 = sumanota1 / a1;


sn = sumanota1 + sumanota2;
prom_total = sn / n;

Console.WriteLine("cantidad de Alumnos aprobados del grupo A2: " +


aprob2);

Console.WriteLine("NOTA PROMEDIO DEL GRUPO A1: " + notapromedio1);

Console.WriteLine("NOTA PROMEDIO DE TODOS LOS ALUMNOS: " +


prom_total);
Console.Read();

3. En una página de compras en línea se muestra un menú de opciones: Añadir el


carrito de compras (A), Eliminar el carrito de compras (E), Cancelar (C) y Salir (S).
Escriba un algoritmo que muestre el menú, efectúe dichas operaciones mostrando el
monto actual de la compra en cada una de ellas, al cancelar el monto se volverá “0”. El
programa termina al seleccionar S.

Miss este ejercicio no me salió bien.


-CODICO C#
int depósito = 0, retiro = 0, saldo = 0;
char opcion;
Console.WriteLine("compra en linea");
Console.WriteLine("opciones del menu");
Console.WriteLine("A: Añadir al carrito");
Console.WriteLine("E: Eliminar de carrito");
Console.WriteLine("C: Cancelar");
Console.WriteLine("S: Salir");
do
{
Console.WriteLine("Ingrese opción de Menu:");
opcion = Convert.ToChar(Console.ReadLine());
switch (opcion)
{
case 'A':
Console.WriteLine("AÑADIR AL CARRITO:");
depósito = Convert.ToInt32(Console.ReadLine());
saldo = saldo + depósito;
Console.WriteLine("EL SALDO ES DE:" + saldo);
break;
case 'E':
Console.WriteLine("ELIMINAR DE CARRITO:");
retiro = Convert.ToInt32(Console.ReadLine());
saldo = saldo - retiro;
Console.WriteLine("EL SALDO ES DE:" + saldo);
break;
case 'C':
saldo = 0;
Console.WriteLine("EL SALDO ES DE:" + saldo);
break;
case 'S':
saldo = 99;
break;
}
}
while (saldo == 99);

Console.ReadLine();

También podría gustarte