By this Code You can check a number is Prime or not....and can you check static array values also..
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class primenumber
{
static void Main(string[] args)
{
int i;
Console.WriteLine("Please enter the nu,mber which u want to test");
int number = Convert.ToInt32(Console.ReadLine());
for ( i = 2; i < number; i++)
{
if (number % i == 0)
{
Console.WriteLine("Number is not prime {0}", number);
break;
}
}
if (number == i)
{
Console.WriteLine("Number is Prime {0}", number);
}
primenumber ob = new primenumber();
ob.checkedi();
Console.ReadKey();
}
public void checkedi()
{
int[] arr = {12,23,34,456,56,1243,123};
for (int j = 0; j < arr.Length; j++)
{
for(int k=2;k<arr.Length; k++)
{
if (arr[j] % k == 0)
{
Console.WriteLine("array number {0} is not prime", arr[j]);
break;
}
else
{
Console.WriteLine("Array number is {0} prime",arr[j]);
break;
}
}
}
}
}
}