3-amaliyot ishi mavzu: stack,queue,dequeue(stek,navbat,dek) variant-14 14


Download 90.97 Kb.
Sana04.11.2023
Hajmi90.97 Kb.
#1748360

3-AMALIYOT ISHI
MAVZU:STACK,QUEUE,DEQUEUE(STEK,NAVBAT,DEK)
VARIANT-14
14. N ta elementdan tashkil topgan dek berilgan. Dekning barcha musbat elementlarini yig’indisini toping.
DASTUR KODI
#include
using namespace std;

int main() {
int N;
cout << "Dekning o'lchamini kiriting: ";
cin >> N;

int dek[N];
cout << "Dekni yaratish: ";

for (int i = 0; i < N; ++i) {
cin >> dek[i];
}

int positiveSum = 0;

for (int i = 0; i < N; ++i) {
if (dek[i] > 0) {
positiveSum += dek[i];
}
}

cout << "Dekning barcha musbat elementlarining yig'indisi: " << positiveSum << endl;

return 0;
}

NATIJA



Bajardi: Nuriddinov Boburbek
Download 90.97 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling