Skip to content

Instantly share code, notes, and snippets.

@gokhanyavas
Created May 16, 2013 07:27
Show Gist options
  • Save gokhanyavas/5590009 to your computer and use it in GitHub Desktop.
Save gokhanyavas/5590009 to your computer and use it in GitHub Desktop.
Dışarıdan girilen NxN boyutlu bir kare matrisin transpozesini bulan c programı .
#include<stdio.h>
#include<conio.h>
int main()
{
int i,j,n;
int yedek;
int mat[10][10];
printf("Kare Matrisin Boyutunu Giriniz :");
scanf("%d",&n);
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
{
printf("%d.satir, %d.sutun elemani :", i,j);
scanf("%d",&mat[i][j]);
}
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
printf("%5d",mat[i][j]);
printf("\n");
}
for(i=2;i<=n;i++)
for(j=1;j<=i-1;j++)
{
yedek=mat[i][j];
mat[i][j]=mat[j][i];
mat[j][i]=yedek;
}
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
printf("%5d",mat[i][j]);
printf("\n");
getch();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment