50 lines
1.2 KiB
C
50 lines
1.2 KiB
C
#include <stdio.h>
|
|
|
|
#define N 7
|
|
#define ZERO 0
|
|
#define ONE 1
|
|
#define TWO 2
|
|
|
|
|
|
//---------------------------------------------------------------------------------------
|
|
// Exercise 2_2
|
|
// ------------
|
|
//
|
|
// 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 = ZERO,
|
|
col = ZERO;
|
|
for (counter = ZERO; counter < 49; counter++)
|
|
{
|
|
col = counter % 7;
|
|
row = counter / 7;
|
|
array[row][col] = counter + ONE;
|
|
array[col + 1][row] = 4 * (N - 1) - col;
|
|
}
|
|
|
|
for (int num = ZERO; num < N; num++)
|
|
{
|
|
for (int num2 = ZERO; num2 < N; num2++)
|
|
{
|
|
printf("%d, ", array[num][num2]);
|
|
}
|
|
printf("\n");
|
|
}
|
|
|
|
} |