Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
videid
/
iax0583
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
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
9c5f51bd
authored
Oct 18, 2017
by
videid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lab6 & 7
parent
fefe20b5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
0 deletions
lab6/lab6.py
lab7/lab7.cpp
lab6/lab6.py
0 → 100644
View file @
9c5f51bd
##TASK1
i
=
int
j
=
int
x
=
0
y
=
0
som
=
[]
def
algorithm
()
:
print
(
"select n"
)
n
=
int
(
input
())
if
(
0
<=
n
<=
10
)
:
print
(
"select m"
)
m
=
int
(
input
())
if
(
0
<=
m
<=
10
):
A
=
[[
0
for
x
in
range
(
n
)]
for
y
in
range
(
m
)]
for
i
in
range
(
0
,
n
):
for
j
in
range
(
0
,
m
):
print
(
"enter element"
,
"["
,
i
,
"]"
,
"["
,
j
,
"]"
)
A
[
i
][
j
]
=
int
(
input
())
for
h
in
range
(
0
,
min
(
m
,
7
)):
som
.
append
(
0
)
for
g
in
range
(
0
,
n
):
som
[
h
]
=
som
[
h
]
+
A
[
g
][
h
]
return
A
,
som
## i don't really get the second question
##,if it is asked to return only the negative
##sums here is the code :
##if som[h] < 0 listofnegativesums.append(som[h]):
## return listofnegativesums
##maybe it is about returning a sum
##of only negative elemtents from the rows
##in which case here is the solution:
##for h in range (0,min(m,7)):
## som.append(0)
## for g in range (0 , n):
## if A[g][h] < 0 :
## som[h] = som[h] + A[g][h]
## return A,som
##TASK2
def
banknotes
():
print
(
"enter S"
)
S
=
int
(
input
())
print
(
"enter number of different Bij"
)
NbBij
=
int
(
input
())
B
=
[]
for
l
in
range
(
NbBij
):
print
(
"enter Bij size"
,
l
)
Bijsize
=
int
(
input
())
B
.
append
([
Bijsize
])
print
(
"enter number of Bij"
,
Bijsize
)
NbofBij
=
int
(
input
())
B
[
l
]
.
append
(
NbofBij
)
return
B
## the question 3 is a complex mathematical problem i have no idea
##how to resolve,the python implementation would be easier though
\ No newline at end of file
lab7/lab7.cpp
0 → 100644
View file @
9c5f51bd
#include <stdio.h>
#define ARRAY_SIZE 25
int
function
(
int
input
);
int
main
()
{
int
array
[
ARRAY_SIZE
]
=
{
0
};
for
(
int
i
=
0
;
i
<
ARRAY_SIZE
;
i
++
)
{
array
[
i
]
=
function
(
i
);
}
for
(
int
j
=
0
;
j
<
ARRAY_SIZE
;
j
++
)
{
int
b
=
array
[
j
];
printf
(
""
,
array
[
j
]);
}
return
0
;
}
int
function
(
int
input
)
{
return
(
input
*
(
input
-
1
));
}
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