This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var lista1 = new Array(10,20,30,-10,-20,-30,69); | |
var sum = 0; | |
function osszegzes(lista, sum) { | |
for(let i=0;i<lista.length;i++){ | |
sum+=lista[i]; | |
} | |
console.log("A Bemeneti lista összege: "+ sum) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lista4 = new Array(10, -10, 20, -20, 30, -30, 50, 100); | |
lista4b = new Array(); | |
var kival = 15 | |
function kivalogatas(lista, kival, lista4b){ | |
let b = 0 | |
for(let i = 0; i < lista.length; i++){ | |
if (lista[i] < kival){ | |
lista4b[b] = lista[i]; | |
b++; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lista3 = new Array(10, -10, 20, -20, 30, -30, 50, 222); | |
var hely = 0; | |
var keres = 20; | |
function kival(lista, keres, hely){ | |
for(let i=0;i<lista.length;i++){ | |
if(lista[i] == keres){ | |
hely = i | |
break | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lista2 = new Array(10, -10, 20, -20, 30, -30, 50, 222); | |
var keres = 9007199254709999; | |
function kereses(lista, keres){ | |
let hely2 = 0; | |
while (hely2 < lista.lenght && lista[hely2] != keres) { | |
hely2++; | |
} | |
if (hely2<lista.lenght){ | |
console.log("Keresett szám indexe: "+ hely2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lista1 = new Array(10, -10, 20, 999, 30, -30); | |
var min = lista1[0]; | |
function minimum(lista, min){ | |
for(let i=0;i<lista.length; i++){ | |
if (lista[i] < min){ | |
min = lista[i]; | |
} | |
} | |
console.log("min: "+min); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lista4 = new Array(10, -10, 20, -20, 30, -30); | |
var db = 0; | |
var T = 20; | |
function megszam(lista, db, T){ | |
for(let i = 0; i < lista.length; i++){ | |
if(lista[i] == T){ | |
db++; | |
}; | |
}; | |
console.log("A listában "+db+" darab keresett (T tulajdonságú "+ T +") szám van."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lista3 = new Array(10, -10, 20, -20, 30, -30); | |
var El = 20; | |
sum = 0; | |
function eldontes(lista, El, sum){ | |
for(let i = 0; i < lista.length; i++){ | |
if (lista[i] != El){ | |
sum++; | |
}; | |
}; | |
if (sum < lista.length){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lista2 = new Array(10, -10, 20, 999, 30, -30); | |
var max = lista2[0]; | |
function maximum(lista, max){ | |
for(let i=0;i<lista.length; i++){ | |
if (lista[i] > max){ | |
max = lista[i]; | |
} | |
} | |
console.log('max: '+max); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Keresés(X[N],T, sorszám) | |
i:=1; | |
Ciklius amíg i<=N és X[i] nem T tulajdonságú | |
i:=i+1; | |
Ciklus vége; | |
Ha i<=N akkor | |
sorszám:=i; | |
Különben | |
sorszám:=-1; | |
Elágazás vége; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Összegzés(X[N],S) | |
S=0; | |
Ciklus i=1-től N-ig | |
S=S+X[i]; | |
Ciklus vége; | |
Eljárás vége; | |
OlderNewer