Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
olpool
/
progII
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
520db76f
authored
Sep 06, 2021
by
olpool
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
see on sama fail uuesti
parents
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
0 deletions
kontrollt662.c
kontrollt662.c
0 → 100644
View file @
520db76f
#include <stdio.h>
int
sisestus
();
int
main
(){
int
i
,
j
,
n
,
b
,
temp
;
n
=
sisestus
();
int
a
[
n
][
n
];
int
summa1
[
2
*
(
n
-
1
)];
for
(
i
=
0
;
i
<
n
;
i
++
){
for
(
j
=
0
;
j
<
n
;
j
++
){
printf
(
"sisesta maatriksi liige %d %d
\n
"
,
i
,
j
);
scanf
(
"%d"
,
&
a
[
i
][
j
]);
}
}
//algab diagonaalidega paralleelsete liitmine
int
z
=
0
;
int
x
=
0
;
x
=
0
;
for
(
b
=
0
;
b
<
n
-
1
;
b
++
){
i
=
b
+
1
;
j
=
b
+
1
;
z
=
0
;
summa1
[
x
]
=
0
;
do
{
summa1
[
x
]
+=
a
[
z
][
i
];
i
++
;
z
++
;
printf
(
"x %d ja summa x %d
\n
"
,
x
,
summa1
[
x
]);
}
while
(
i
<=
n
-
1
);
x
++
;
z
=
0
;
summa1
[
x
]
=
0
;
do
{
summa1
[
x
]
+=
a
[
j
][
z
];
j
++
;
z
++
;
printf
(
"x %d ja summa x %d
\n
"
,
x
,
summa1
[
x
]);
}
while
(
j
<=
n
-
1
);
x
++
;
}
// algab sortimine kasvavas j'rjekorras
for
(
j
=
0
;
j
<
2
*
(
n
-
1
);
j
++
)
{
for
(
i
=
0
;
i
<
n
-
j
;
i
++
)
{
if
(
summa1
[
i
+
1
]
<
summa1
[
i
])
{
temp
=
summa1
[
i
];
summa1
[
i
]
=
summa1
[
i
+
1
];
summa1
[
i
+
1
]
=
temp
;
}
}
}
for
(
i
=
0
;
i
<
2
*
(
n
-
1
);
i
++
)
{
printf
(
"jada %d liige: %d
\n
"
,
i
,
summa1
[
i
]);
}
return
0
;
}
int
sisestus
(){
int
temp
;
printf
(
"sisesta ruutmaatriksi veergude ja ridade arv
\n
"
);
scanf
(
"%d"
,
&
temp
);
return
temp
;
}
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