Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int neigh_sum(int arr[][SIZE], int row, int col)
- {
- int current_row, current_col, i, j, sum1 =0, sum2 =0;
- for (current_row = row - 1; current_row = < row + 1; current_row++) {
- for (current_col = col - 1; current_col = < col + 1; current_col++) {
- if(current_row < 0)
- i = SIZE - 1;
- else if (current_row >= SIZE)
- i = 0;
- else i = current_row;
- if (current_col < 0)
- j = SIZE - 1;
- else if (current_col >= SIZE)
- j = 0;
- else j = current_col;
- sum1 = sum1 + arr [i][j]; } }
- sum2 = sum1 - arr[row][col];
- returm sum2;
- }
- void remove_cells(int arrSrc[][SIZE], int arrDst[][SIZE], int low, int high)
- {
- int row, col;
- for (row=0; row < SIZE; row++){
- for (col=0; col< size; col++){
- if (low <= neigh_sum(arrSrc, row ,col) && neigh_sum(arrSrc, row ,col) <= high)
- arrDst[row][col] = arrSrc [row][col] ;
- else arrDst[row][col] = 0; } }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement