Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
raliis
/
IAX0583
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f8a8e8db
authored
Sep 30, 2017
by
raliis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Maatriksi diagonaalide liitmise programm
parent
c6de428f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
maatriks_diagonaal.c
maatriks_diagonaal.c
0 → 100644
View file @
f8a8e8db
#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
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment