#include void trykiMassiiv(int mas[8][8]){ int i,j; for(i=0; i<8; i++){ for(j=0; j<8; j++){ printf("%d ", mas[i][j]); } printf("\n"); } } int main(void){ int i,j; int rida, veerg; int rida2, veerg2; int m[8][8]; for(i=0; i<8; i++){ for(j=0; j<8; j++){ m[i][j] = 0; if (i<3){ if (i%2> 0 && j%2> 0) {m [i][j] =1;} if (i%2==0 && j%2==0) {m [i][j] =1;} } if (i>4){ if (i%2> 0 && j%2> 0) {m [i][j] =2;} if (i%2==0 && j%2==0) {m [i][j] =2;} } } } trykiMassiiv(m); while(1==1){ printf("Palun sisesta rida: "); scanf("%d", &rida); printf("Palun sisesta veerg: "); scanf("%d", &veerg); printf("Sellel ruudul asub %d\n", m[rida-1][veerg-1]); printf("Palun sisesta rida, kuhu soovid nuppu liigutada: "); scanf("%d", &rida2); printf("Palun sisesta veerg, kuhu soovid nuppu liigutada: "); scanf("%d", &veerg2); m[rida2-1][veerg2-1]=m[rida-1][veerg-1]; m[rida-1][veerg-1]=0; trykiMassiiv(m); } return 0; }