Created
May 16, 2021 22:02
-
-
Save DiracSpace/a572cd78a337dfbac3109265080ab671 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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