Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int mat[1000][1000],i,j,m,n;
- int e_palindrom=0;
- scanf("%d%d", &m,&n);
- for(i=0;i<m;i++){
- for(j=0;j<n;j++)
- scanf("%d", &mat[i][j]);
- }
- for(i=0;i<m;i++){
- int j_kraj=n-1;
- for(j=0;j<n;j++){
- if(mat[i][j_kraj]==mat[i][j])
- e_palindrom=1;
- else{
- e_palindrom=0;
- break;
- }
- j_kraj -= 1;
- }
- if(e_palindrom==0){
- break;
- }
- }
- for(i=0;i<n;i++){
- int i_kraj=m-1;
- for(j=0;j<m;j++){
- if(mat[j][i]==mat[i_kraj][i]) {
- e_palindrom=1;
- }
- else{
- e_palindrom=0;
- break;
- }
- i_kraj -= 1;
- }
- if(e_palindrom==0){
- break;
- }
- }
- if(e_palindrom){
- printf("Matricata e palindrom");
- }
- else
- printf("Ne e palindrom");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment