#include <stdio.h> int main() { int m, n, i, j; int sum = 0; scanf("%d %d\n", &m, &n); int arr[10][10] = {0}; for(i=0; i<m; i++) for(j=0; j<n; j++) { scanf("%d ", &arr[i][j]); if(arr[i][j] > 0) sum += arr[i][j]; } printf("%d\n", sum); return 0; }
#include <stdio.h> int main() { int m, n, i, j; int sum = 0; scanf("%d %d\n", &m, &n); int arr[10][10] = {0}; for(i=0; i<m; i++) for(j=0; j<n; j++) { scanf("%d ", &arr[i][j]); if(arr[i][j] > 0) sum += arr[i][j]; } printf("%d\n", sum); return 0; }