View Code of Problem 45

#include<stdio.h>
#include<stdlib.h>
int main(){
  int i,j,n,a[20][20];
  while(scanf("%d",&n))
  {
  	for(i=0;i<20;i++)
        {
        	for(j=0;j<20;j++)
                  scanf("%d",&a[i][j]);
        }
    for(i=0;i<n-1;i++){
      for(j=i+1;j<n;j++){
      	int team;
        team=a[i][j];
      	a[i][j]=a[j][i];
        a[j][i]=team;
      	}
    }
    for(i=0;i<20;i++)
    {
      for(j=0;j<20;j++){
        if(j==n-1)
      	printf("%d\n",a[i][j]);
        else
          printf("%d",a[i][j]);
      }
    }
  }
  
  return 0;
}

Double click to view unformatted code.


Back to problem 45