Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <ctype.h>
- int main()
- {
- int n,m;
- int maksimalen_broj=-1000000;
- int mi;
- int mj;
- scanf("%d%d",&n,&m);
- int mat[n][m];
- for(int i=0;i<n;i++)
- for(int j=0;j<m;j++){
- scanf("%d", &mat[i][j]);
- if(maksimalen_broj<mat[i][j]){
- maksimalen_broj=mat[i][j];
- mi=i;
- mj=j;
- }
- }
- if(mi -1>=0 && mj -1>=0){ // gore i levo
- printf("%d ",mat[mi-1][mj-1]);
- }
- if(mi-1>=0 && mj+1<m){ // gore i desno
- printf("%d ",mat[mi-1][mj+1]);
- }
- if(mi+1<n && mj-1>=0){ // dole i levo
- printf("%d ",mat[mi+1][mj-1]);
- }
- if(mi+1<n && mj+1<m){ // dole i desno
- printf("%d ",mat[mi+1][mj+1]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement