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
2097d10f
authored
Sep 30, 2017
by
raliis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Maatriksi diagonaalide ülesanne
parent
28d650e8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
maatriks_diagonaalid.c
maatriks_diagonaalid.c
0 → 100644
View file @
2097d10f
#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
Summa1
=
0
;
int
Summa2
=
0
;
int
a
;
int
b
;
int
x
;
int
y
;
int
main
(
void
){
int
Summa1
=
0
;
int
a
=
0
;
int
b
=
0
;
while
(
a
<
m
){
if
(
a
==
b
&&
A
[
a
][
b
]
>
0
){
Summa1
=
Summa1
+
A
[
a
][
b
];
}
b
++
;
a
++
;
}
int
Summa2
=
0
;
int
x
=
0
;
int
y
=
3
;
while
(
x
<
m
){
if
(
x
+
y
==
3
){
Summa2
=
Summa2
+
A
[
x
][
y
];
}
y
--
;
x
++
;
}
if
(
Summa1
>
Summa2
){
printf
(
"Diagonaalide summad on: %d ja %d"
,
Summa1
,
Summa2
);
}
else
{
printf
(
"Diagonaalide summad on: %d ja %d"
,
Summa2
,
Summa1
);
}
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