using System;
public class Program
{
public static void Main()
int [] numArray = {1, 2, 3, 4};
// To check if the value 3 exists in the array, you write
int result = Array.IndexOf(numArray, 3);
Console.WriteLine(result); // Prints 2
// If you write
int result1 = Array.IndexOf(numArray, 5);
Console.WriteLine(result1); // Prints -1
// The value of result is -1 because 5 does not exist in the numArray.
}