Skip to content

Instantly share code, notes, and snippets.

@DiracSpace
Created May 16, 2021 22:02
Show Gist options
  • Save DiracSpace/a572cd78a337dfbac3109265080ab671 to your computer and use it in GitHub Desktop.
Save DiracSpace/a572cd78a337dfbac3109265080ab671 to your computer and use it in GitHub Desktop.
using System;
public class Program
{
public static void Main()
{
/*
Programa para encontrar el máximo y mínimo de una
lista de números
*/
int[] numeros = {2, 42, 23, 4, 6};
int min = numeros[0];
int max = numeros[0];
for(int i = 1; i < numeros.Length; i++)
{
if (numeros[i] > max)
max = numeros[i];
if (numeros[i] < min)
min = numeros[i];
}
Console.WriteLine("Max " + max);
Console.WriteLine("Min " + min);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment