0% found this document useful (0 votes)
27 views2 pages

Int Int Int New Int String New String String New String Int New Int For Int

The document contains code for two exercises. The first exercise collects employee data including name, last name, age, and code into arrays. It then prints the employee data in a table and finds employees with even ages. It also allows searching by code. The second exercise collects student grades over three tests, calculates the average, and counts students above and below 13.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views2 pages

Int Int Int New Int String New String String New String Int New Int For Int

The document contains code for two exercises. The first exercise collects employee data including name, last name, age, and code into arrays. It then prints the employee data in a table and finds employees with even ages. It also allows searching by code. The second exercise collects student grades over three tests, calculates the average, and counts students above and below 13.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

EJERCICIO 01

int n = 0;
Console.WriteLine("numero de elemento:");
n = int.Parse(Console.ReadLine());
int[] codigo = new int[n];
string[] nombre = new string[n];
string[] apellido = new string[n];
int[] edad = new int[n];

for (int i = 0; i < n; i++)


{
Console.WriteLine("empleado{0}", i + 1);
Console.WriteLine("nombre:");
nombre[i] = Console.ReadLine();
Console.WriteLine("apellido:");
apellido[i] = Console.ReadLine();
Console.WriteLine("edad:");
edad[i] = int.Parse(Console.ReadLine());
Console.WriteLine("codigo:");
codigo[i] = int.Parse(Console.ReadLine());
}

Console.WriteLine("nombre\t apellido\t edad\t codigo");

for (int i = 0; i < n; i++)


{
Console.WriteLine("{0}\t {1}\t {2}\t {3}", nombre[i], apellido[i],
edad[i], codigo[i]);
}

Console.WriteLine("par");
for (int i = 0; i < n; i++)
{
if (edad[i] % 2 == 0)
{

Console.WriteLine("{0}\t {1}\t {2}", nombre[i], apellido[i],


edad[i], codigo[i], i + 1);
}
}

int codbus = 0;
Console.WriteLine("ingrese codigo");
codbus = int.Parse(Console.ReadLine());

for (int i = 0; i < n; i++)


{

if (codigo[i] == codbus)
{

Console.Write("{0}\t {1}\t{2}", nombre[i], apellido[i], edad[i],


codigo[i], i + 1);

}
}
Console.ReadKey();

EJERCICIO 02

double n1, n2, n3, pr, capb = 0, cdes = 0;


int n = 0;

Console.WriteLine("Numero de Alumnos:");
n = int.Parse(Console.ReadLine());

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


{
Console.WriteLine("Ingrese registro almuno {0}", i);
Console.WriteLine("Ingrese nota 1:");
n1 = double.Parse(Console.ReadLine());
Console.WriteLine("Ingrese nota 2:");
n2 = double.Parse(Console.ReadLine());
Console.WriteLine("Ingrese nota 3:");
n3 = double.Parse(Console.ReadLine());
pr = (n1 + n2 + n3) / 3;
Console.WriteLine("Su promedio es {0}", pr);

if (pr >= 13 && pr <= 20)


{
capb = capb + 1;
}
else if (pr >= 0 && pr < 13)
{
cdes = cdes + 1;
}
}

Console.WriteLine("Promedio mayor {0}",capb);


Console.WriteLine("Promedio menor{0}", cdes);
Console.ReadKey();

You might also like