Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created Jun 11, 2021
Embed
What would you like to do?
using System;
namespace App
{
class Programa
{
static void Main(string[] args)
{
int[] numeros = { 999, 28, 11, 96, 1, 2, 45, 0, 1 };
int busqueda = 855;
int indice = Array.IndexOf(numeros, busqueda);
if (indice == -1)
{
Console.WriteLine("El elemento {0} no existe", busqueda);
}
else
{
Console.WriteLine("El elemento {0} existe en la posición {1}", busqueda, indice);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment