Skip to content

Commit

Permalink
For mejorado (foreach en C#[39]#️⃣)
Browse files Browse the repository at this point in the history
  • Loading branch information
programadornovato committed May 13, 2021
1 parent b22df98 commit 092cb58
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions HolaMundo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ class Program
{
static void Main(string[] args)
{
int[] arregloNumeros = new int[] {5,8,3,7,4,1 };
Console.WriteLine("El elemento numero 4="+ arregloNumeros[3]);
Console.WriteLine("Longitud del arreglos es "+arregloNumeros.Length);
for (int i= 0; i < arregloNumeros.Length; i++) {
Console.WriteLine("El valor del elemento "+(i+1)+" es "+arregloNumeros[i]);
string[] perros=new string[] { "Monte","Chupacabras","Solovino","Chimuelo","El chiquito" };
Console.WriteLine("CICLO CON FOR");
for (int i = 0; i < perros.Length; i++) Console.WriteLine("El perro "+i+" es "+perros[i]);

Console.WriteLine("CICLO CON FOREACH");
int j = 0;
foreach (string perro in perros) {
Console.WriteLine("El perro "+j+" es "+perro);
j++;
}

Console.Read();
}
}
Expand Down

0 comments on commit 092cb58

Please sign in to comment.