using System;
public class Program
{
public static bool IsPrimeNumber(int n) {
bool isPrimeNum = true;
if (n != 2 && (n == 1 || n % 2 == 0)) {
isPrimeNum = false;
} else {
for (int i = 3; i <= n/2; i += 2) {
if (n % i == 0) {
break;
}
return isPrimeNum;
public static void Main()
int[,] nums = {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {11, 12, 13, 14, 15, 16, 17, 18, 19, 20}, {21, 22, 23, 24, 25, 26, 27, 28, 29, 30}};
foreach (int i in nums) {
if (IsPrimeNumber(i))
Console.Write("{0:D2} ", i);
else
Console.Write(" X ");
if (i % 10 == 0)
Console.WriteLine();