Commit 28d650e8 by raliis

Delete maatriks_diagonaal.c

parent f8a8e8db
Showing with 0 additions and 53 deletions
#include <stdio.h>
int n=4; int m=4; //maatriksi mõõdud
int A[4][4]={{-3,2,7,9},{6,-3,12,5},{3,7,7,8},{5,2,1,0}};
int Summa = 0;
int main(void){
int i=0;
int j=0;
while (i<n){
j=0;
while(j<m){
printf("%4d", A[i][j]);
j++;
}
printf("\n");
i++;
}
int peadiagonaal(void){
int Summa = 0;
int i=0;
int j=0;
while(i<m){
if(i==j && A[i][j]>0){
Summa = Summa + A[i][j];
}
j++;
i++;
printf("%d", Summa);
}
}
int k6rvaldiagonaal(void){
int Summa = 0;
int i=0;
int j=0;
while(i<m){
if(i+j==3){
Summa = Summa + A[i][j];
}
j++;
i++;
printf("%d", Summa);
}
}
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment