matura 20.05

This commit is contained in:
aguzik 2024-05-21 09:17:59 +02:00
commit b73a399210
4 changed files with 55 additions and 0 deletions

11
index.html Normal file
View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script src="scirpt.js"></script>
</body>
</html>

15
main.py Normal file
View File

@ -0,0 +1,15 @@
def iloczyn(x: int ,y: int ) -> int:
if y == 1:
return x
else:
k = y // 2
z = iloczyn(x,k)
if y % 2 == 0:
return z + z
else:
return x + z + z
print(iloczyn(9,11))
print(iloczyn(9,5))
print(iloczyn(9,2))
print(iloczyn(9,1))

17
scirpt.js Normal file
View File

@ -0,0 +1,17 @@
function iloczyn(x, y) {
if (y == 1) {
return x;
} else {
k = Math.floor(y / 2);
z = iloczyn(x, k);
if (y % 2 == 0) {
return z + z;
} else {
return x + z + z;
}
}
}
console.log(iloczyn(9, 11));
console.log(iloczyn(9, 5));
console.log(iloczyn(9, 1));

12
sufix.js Normal file
View File

@ -0,0 +1,12 @@
function sufixy(slowo) {
dlugosc = slowo.length;
let wynik = Array();
for (let i = 0; i < dlugosc; i++) {
wynik.push(slowo);
slowo = slowo.slice(1);
}
return "Nieposortowane: " + wynik + ", Posortowane: " + wynik.sort();
}
console.log(sufixy("slowo"));