SHARE
TWEET

Untitled

a guest Dec 10th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.  
  6. int a[20][20],i,j,ok=1,n,aux;
  7.  
  8. printf("n=");
  9. scanf("%i",&n);
  10. printf("\n");
  11.  
  12. for(i=1;i<=n;++i)
  13.     for(j=1;j<=n;++j)
  14.         {
  15.         printf("a[%d][%d]=",i,j);
  16.         scanf("%i",&a[i][j]);
  17.         }
  18.        
  19. for(i=2;i<=n;++i)
  20.     for(j=1;j<i;++j)
  21.         if(a[i][j]==0)ok=0;
  22.        
  23. for(i=2;i<=n;++i)
  24.     for(j=1;j<i;++j)
  25.         {
  26.         aux=a[i][j];
  27.         a[i][j]=a[j][i];
  28.         a[j][i]=aux;
  29.         }
  30.  
  31. if(ok==0)
  32.     for(i=1;i<=n;++i)
  33.     {
  34.          printf("\n");
  35.          for(j=1;j<=n;++j)
  36.              if(j>=2) printf("%5i",a[i][j]);
  37.              else printf("%i",a[i][j]);
  38.     }
  39.    
  40.  
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top