# C# Program to find prime numbers in an array

In this program, You will learn how to find prime numbers in an array in C#.

`Some prime elements is: 5 7 11 13`

## Example: How to find prime numbers in an array in C#.

```
using System;
public class Program
{
public static void Main(string[] args)
{
int i, j, p;
int[] arr = new int[5];
Console.Write("Enter array elements:");
for (i = 0; i < arr.Length; i++)
{
arr[i] = Convert.ToInt32(Console.ReadLine());
}
Console.Write("All Prime List:");
for (i = 0; i < arr.Length; i++)
{
j = 2;
p = 1;
while (j < arr[i])
{
if (arr[i] % j == 0)
{
p = 0;
break;
}
j++;
}
if (p == 1)
{
Console.Write(arr[i] + " ");
}
}
}
}
```

#### Output:

```
Enter array elements:2
3
4
5
6
All Prime List:2 3 5
```