Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
grtrol
/
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
580d3c59
authored
Sep 26, 2017
by
grtrol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tunnitöö4
parent
bd2c1f8c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
94 additions
and
0 deletions
praktikum4/tunnit66.c
praktikum4/tunnit66.py
praktikum4/tunnityy1.c
praktikum4/tunnit66.c
0 → 100755
View file @
580d3c59
#include<stdio.h>
int
n
=
4
;
int
m
=
3
;
int
A
[
4
][
3
]
=
{{
5
,
-
3
,
-
12
},{
2
,
3
,
-
2
},{
1
,
-
6
,
8
},{
-
4
,
-
13
,
4
}};
void
negSummad
(
void
);
void
trykiMaatriks
(
int
n
,
int
m
,
int
[
n
][
m
]);
int
main
(
void
)
{
trykiMaatriks
(
n
,
m
,
A
);
negSummad
();
return
0
;
}
void
trykiMaatriks
(
int
n
,
int
m
,
int
A
[
n
][
m
])
{
int
i
=
0
;
int
j
=
0
;
while
(
i
<
n
)
{
j
=
0
;
while
(
j
<
m
)
{
printf
(
"%4d"
,
A
[
i
][
j
]);
j
++
;
}
printf
(
"
\n
"
);
i
++
;
}
}
void
negSummad
(
void
)
{
int
i
=
0
;
int
j
=
0
;
int
negsum
[
m
];
printf
(
"Tulpade negatiivsete elementide summad on:
\n
"
);
while
(
j
<
m
)
{
i
=
0
;
while
(
i
<
n
)
{
if
(
A
[
i
][
j
]
<
0
)
negsum
[
j
]
+=
A
[
i
][
j
];
i
++
;}
printf
(
"%4d"
,
negsum
[
j
]);
j
++
;
}
printf
(
"
\n
"
);
}
praktikum4/tunnit66.py
0 → 100755
View file @
580d3c59
# Python
# 6lesande tekstis antud v22rtused
n
=
4
processRowsBefore
=
2
# algv22rtustamine
A
=
[[
2
,
3
,
-
4
,
3
],
[
1
,
2
,
-
3
,
0
],
[
1
,
2
,
3
,
4
],
[
1
,
2
,
3
,
4
]]
#ridade positiivseste elementide 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 v2ljastamine
for
i
in
range
(
len
(
rowSums
)):
print
(
"summa :
%
d "
)
%
rowSums
[
i
]
praktikum4/tunnityy1.c
0 → 100755
View file @
580d3c59
#include<stdio.h>
int
main
(
void
)
{
int
n
=
4
,
m
=
4
;
int
i
,
j
;
int
A
[
4
][
4
]
=
{{
2
,
3
,
-
4
,
3
},{
1
,
2
,
-
3
,
0
},{
1
,
2
,
3
,
4
},{
1
,
2
,
3
,
4
}};
int
rowSum
[
n
];
for
(
i
=
0
;
i
<
n
;
i
++
)
{
rowSum
[
i
]
=
0
;
for
(
j
=
0
;
j
<
m
;
j
++
)
{
if
(
A
[
i
][
j
]
>
0
)
{
rowSum
[
i
]
+=
A
[
i
][
j
];
}
}
}
for
(
i
=
0
;
i
<
n
;
i
++
)
{
printf
(
"Maatriksi %d. rea summa on %d
\n
"
,
i
,
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