הצלחתי :-)
קוד:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
public static bool Check (int[,] a)
{
for (int i = 1; i < N - 1; i++)
{
for (int j = 1; j < M - 1; j++)
{
if (a[i - 1, j - 1] + a[i - 1, j] + a[i - 1, j + 1] + a[i, j - 1] + a[i, j + 1] + a[i + 1, j - 1] + a[i + 1, j] + a[i + 1, j + 1] <= 0)
return true;
}
}
return false;
}
static void Main(string[] args)
{
int[,] a = new int[N, M];
for (int i=0; i<N;i++)
for (int j=0;j<M;j++)
{
Console.WriteLine ("enter a number");
a[i,j] = int.Parse(Console.ReadLine());
}
Console.WriteLine(Check(a));
}
}
}
היה לי CONST כדי לבדוק אז ערכתי כדי למחוק