Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int n = -1;
- int sum = 0;
- int max;
- for (int i = 0; i < M; i++){
- if(A[i][1] < 0) max = A[i][1];
- else max = 0;
- for(int j = 0; j < N; j++){
- if( (max > A[i][j] && A[i][j] < 0) && (j % 2 == 0) ){
- max = A[i][j];
- n = j ;
- }
- if(A[i][j] < 0 && j % 2 == 0) sum = sum + A[i][j];
- }
- if(n > 0) A[i][n] = sum;
- sum = 0;
- n = -1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement