36 lines
977 B
C
36 lines
977 B
C
#define N 7
|
|
#define ZERO 0
|
|
#define ONE 1
|
|
#define TWO 2
|
|
|
|
//---------------------------------------------------------------------------------------
|
|
// Exercise 2_1
|
|
// ------------
|
|
//
|
|
// General : None.
|
|
//
|
|
// Input : None.
|
|
//
|
|
// Process : None.
|
|
//
|
|
// Output : None.
|
|
//
|
|
//---------------------------------------------------------------------------------------
|
|
// Programmer : Cohen Idan
|
|
// Student No : 211675038
|
|
// Date : 27.10.2019
|
|
//---------------------------------------------------------------------------------------
|
|
void main(void)
|
|
{
|
|
int array[N][N] = { ZERO };
|
|
unsigned int counter,
|
|
area = N * N,
|
|
row,
|
|
col;
|
|
for (counter = ZERO; counter < area; counter++)
|
|
{
|
|
row = counter / N;
|
|
col = counter % N;
|
|
array[row][col] = (counter + ONE) + ((N - ONE - (TWO * col)) * (row % TWO));
|
|
}
|
|
} |