-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path00_2D.c
More file actions
30 lines (21 loc) · 999 Bytes
/
00_2D.c
File metadata and controls
30 lines (21 loc) · 999 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <stdio.h>
int str = 3,stb=3;
int ematrixp(int m[][3]){ //die Funktion prüft ob es eine Einheitsmatrix ist
int i,j,r=1;
if(str!=stb) r=0;
else{
for(i=0; i<str; i++){
for(j=0; j<stb; j++){
if((i==j) && (m[i][j]!=1)) r=0;
else if((i!=j) && (m[i][j]!=0)) r=0;
}}}
return r;
};
int main(){
printf("\n");
int m [3][3] = {{1,0,0},//unsere Matrix, die geprüft wird
{0,1,0},
{0,0,1}};
printf("%d \n", ematrixp(m));//0-falls keine Einheitsmatrix, 1- falls Einheitsmatrix
return 0;
}