CodesC/TP4/matrice.c

37 lines
624 B
C

#include <stdio.h>
#define N 10
int main () {
int i,j;
int A[N][N];
for (i = 0 ; i< N ; i++) {
for (j = 0 ; j< N ; j++) {
A[i][j] = (i+1)*(i+1)*(i+1)-(j+1)*(j+1)*(j+1);
printf("%d ",A[i][j]);
}
printf("\n");
}
int pair = 0 ;
int impair = 0 ;
for (i = 0 ; i< N ; i++) {
for (j = 0 ; j< N ; j++) {
if ( (i+j)%2 == 0 ) {
pair ++ ;
} else {
impair ++ ;
}
}
}
printf("%d %d \n",pair,impair);
}