View Code of Problem 45

 #include <stdio.h>     
    int main()
    {
    	int n,tmp;
    	scanf("%d",&n);
    	int s[n][n];
    	for(int i=0;i<n;++i)
    	{
    		for(int j=0;j<n;++j)
    		{
    			scanf("%d",&s[i][j]);
    		}
    	}
    	
    	 for(int i = 0; i < n; ++i)
    	 {
            for(int j = i; j < n; ++j)
    		{
                tmp = s[i][j];
                s[i][j] = s[j][i];
                s[j][i] = tmp;
            }
        }
        for(int i=0;i<n;++i)
    	{
    		for(int j=0;j<n;++j)
    		{
    		  printf("%d",s[i][j]);
    		}
          printf("\n");
    	}
    	
    	return 0;
    }

Double click to view unformatted code.


Back to problem 45