Created
May 16, 2013 07:31
-
-
Save gokhanyavas/5590026 to your computer and use it in GitHub Desktop.
Ana köşegen üzerindeki elemanları “1” , diğer bütün elemanları “0” olan matrise “birim matris”
denir. Dışarıdan girilen N sayısına göre NxN tipinde birim matris oluşturan c programı.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<conio.h> | |
int main() | |
{ | |
int i,j,n; | |
int mat[10][10]; | |
printf("Kare Matrisin Boyutunu Giriniz..:"); | |
scanf("%d",&n); | |
for(i=0;i<n;i++) | |
for(j=0;j<n;j++) | |
if (i==j) mat[i][j]=1; | |
else mat[i][j]=0; | |
for(i=0;i<n;i++) | |
{ | |
for(j=0;j<n;j++) | |
printf("%3d",mat[i][j]); | |
printf("\n"); | |
getch(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#include<stdio.h>
#include<conio.h>
int main()
{
int i,j,n;
int mat[10][10];
printf("Kare Matrisin Boyutunu Giriniz..:");
scanf("%d",&n);
for(i=0;i<n;i++)
for(j=0;j<n;j++)
if (i==j) mat[i][j]=1;
else mat[i][j]=0;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
printf("%3d",mat[i][j]);
printf("\n");
getch();
}
}