Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
rallui
/
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
6616bb5b
authored
Oct 24, 2017
by
rallui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
8ff81359
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
0 deletions
Tunnitööd/ktprogramm.c
Tunnitööd/ktprogramm.c
0 → 100644
View file @
6616bb5b
//Maatriksist lugeda alates kolmandast reast negatiivsete elementide korrutised ja väljastada need kahanevalt.
//Maatriksist lugeda alates kolmandast reast negatiivsete elementide korrutised ja väljastada need kahanevalt.
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
int
main
()
{
srand
(
time
(
NULL
));
int
n
,
m
,
i
,
j
,
k
,
abi
;
int
MaxN
=
15
;
int
MaxM
=
15
;
int
A
[
MaxN
][
MaxM
];
int
Korrutis
[
15
];
do
// Elementide sisestus
{
printf
(
"Sisesta N: "
);
scanf
(
"%d"
,
&
n
);
printf
(
"Sisesta M: "
);
scanf
(
"%d"
,
&
m
);
}
while
((
n
<
3
||
n
>
MaxN
)
||
(
m
>
MaxM
||
m
<
0
));
for
(
i
=
0
;
i
<
n
;
i
++
)
{
for
(
j
=
0
;
j
<
m
;
j
++
)
{
printf
(
"Element A[%d][%d] : "
,
i
,
j
);
A
[
i
][
j
]
=
rand
()
%
200
-
100
;
//Suvalised arvud
printf
(
"%d
\n
"
,
A
[
i
][
j
]);
}
}
k
=
0
;
for
(
i
=
0
;
i
<
n
;
i
++
)
{
Korrutis
[
k
]
=
1
;
for
(
j
=
0
;
j
<
m
;
j
++
)
{
if
(
A
[
i
][
j
]
<
0
)
{
Korrutis
[
k
]
=
Korrutis
[
k
]
*
A
[
i
][
j
];
}
}
k
++
;
}
i
=
0
;
}
for
(
k
=
0
;
k
<
n
-
i
;
k
++
)
{
for
(
i
=
0
;
i
<
n
-
1
;
i
++
)
{
for
(
j
=
0
;
j
<
m
-
1
;
j
++
)
{
if
(
Korrutis
[
k
]
<
Korrutis
[
k
+
1
];
abi
=
Korrutis
[
k
];
Korrutis
[
k
]
=
Korrutis
[
k
-
1
]
:
Korrutis
[
k
-
1
]
=
abi
;
}
}
}
printf
(
"Korrutiseväärtus :%d
\n
"
,
Korrutis
[
k
]);
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