Function multiplyFirstEven(arr) { let result = ; let firstEvenIndex = -1; for (let i = 0; i < arr length; i++) { if (arr[i] 0) { if (firstEvenIndex -1) { firstEvenIndex = i




Download 16.38 Kb.
Sana11.05.2023
Hajmi16.38 Kb.
#58316
Bog'liq
KT 3-amaliy ish
loyihalash, 1-MAVZU TOPSHIRIQ Ehtimolik va statistika-DTBS16MBK (3), 2-MAVZU TOPSHIRIQ Ehtimolik va statistika-DTBS16MBK

Muhammad al-Xorazmiy nomidagi Toshkent axborot texnologiyalari universiteti

Amaliy ish № 3


Assemblear tili
To‘ldiruvchi: Abdurashidov Bexruz
Guruh:316_21
Qabul qildi: Axrorov Faxriddin
Toshkent 2023





function multiplyFirstEven(arr) {
let result = 1;
let firstEvenIndex = -1;
for (let i = 0; i < arr.length; i++) {
if (arr[i] % 2 === 0) {
if (firstEvenIndex === -1) {
firstEvenIndex = i;
}
result *= arr[i];
}
}
if (firstEvenIndex === -1) {
return arr;
}
for (let i = firstEvenIndex + 1; i < arr.length; i++) {
if (arr[i] % 2 === 0) {
result *= arr[i];
}
}
return result;
}
Download 16.38 Kb.




Download 16.38 Kb.

Bosh sahifa
Aloqalar

    Bosh sahifa



Function multiplyFirstEven(arr) { let result = ; let firstEvenIndex = -1; for (let i = 0; i < arr length; i++) { if (arr[i] 0) { if (firstEvenIndex -1) { firstEvenIndex = i

Download 16.38 Kb.