View Code of Problem 45

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

Double click to view unformatted code.


Back to problem 45