ivana_andreevska

Untitled

May 11th, 2021
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.77 KB | None | 0 0
  1. Да се напише програма која за квадратна матрица внесена од тастатура ќе испечати на екран дали таа е симетрична во однос на главната дијагонала.
  2. #include <stdio.h>
  3. int main()
  4. {
  5.     int matrica[100][100];
  6.     int i,j;
  7.     int m;
  8.     scanf("%d",&m);
  9.  
  10.     for(i=0;i<m;i++)
  11.     {
  12.         for(j=0;j<m;j++){
  13.             scanf("%d",&matrica[i][j]);
  14.         }
  15.     }
  16.  
  17.     int simetricna=1;
  18.     for(i=0;i<m-1;i++)
  19.     {
  20.         for(j=i+1;j<m;j++){
  21.             if(matrica[i][j]!=matrica[i][j]){
  22.                 simetricna=0;
  23.             }
  24.         }
  25.     }
  26.     if(simetricna)
  27.         printf("YES");
  28.     else
  29.         printf("NE");
  30.     return 0;
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment