First Upload
This commit is contained in:
50
7/ex2_2.c
Normal file
50
7/ex2_2.c
Normal file
@@ -0,0 +1,50 @@
|
||||
#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");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user