Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
eglill
/
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
8d3ccf60
authored
Sep 26, 2017
by
eglill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tunnitöö4
parent
3b9c8ecf
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
0 deletions
Praktikum4/Tund.py
Praktikum4/TundCC.c
Praktikum4/Tund.py
0 → 100755
View file @
8d3ccf60
# Python v.3.6.2
# Eeldan, et sisendvaartustena kasutatakse vaid taisarve.
# kasutajale kuvatud indeksid on matemaatilised (algavad uhest)
# Ulesande tekstis antud vaartused
n
=
4
processRowsBefore
=
2
#--
# Algvaartustamine
A
=
[[
2
,
3
,
-
4
,
3
],
[
1
,
2
,
-
3
,
0
],
[
1
,
2
,
3
,
4
],
[
1
,
2
,
3
,
4
]]
# Rideade positiivsete elementide summa leidmine
rowSums
=
[]
for
row
in
range
(
processRowsBefore
-
1
):
rowSum
=
0
for
col
in
range
(
n
):
if
A
[
row
][
col
]
>
0
:
rowSum
+=
A
[
row
][
col
]
rowSums
.
append
(
rowSum
)
# Tulemuste valjastamine
for
i
in
range
(
len
(
rowSums
)):
print
(
str
(
rowSums
[
i
]))
Praktikum4/TundCC.c
0 → 100755
View file @
8d3ccf60
#include<stdio.h>
int
main
(
void
)
{
int
n
=
4
;
int
rowSum
[
4
];
int
i
=
0
;
int
j
=
0
;
int
A
[
4
][
4
]
=
{{
2
,
3
,
-
4
,
3
},
{
1
,
2
,
-
3
,
0
},
{
1
,
2
,
3
,
4
},
{
1
,
2
,
3
,
4
}};
for
(
i
=
0
;
i
<
4
;
i
++
)
{
rowSum
[
i
]
=
0
;
for
(
j
=
0
;
j
<
n
;
j
++
)
{
if
(
A
[
i
][
j
]
>
0
)
{
rowSum
[
i
]
+=
A
[
i
][
j
];
}
}
}
for
(
i
=
0
;
i
<
4
;
i
++
)
printf
(
"%d
\n
"
,
rowSum
[
i
]);
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