1-Labaratoriya ishi n ta elemetndan tashkil topgan massiv ( N–natural son) Guruh


Download 1.29 Mb.
Sana25.12.2022
Hajmi1.29 Mb.
#1064986
Bog'liq
1-Labaratoriya 87632


1-Labaratoriya ishi
N TA ELEMETNDAN TASHKIL TOPGAN MASSIV
( N–NATURAL SON)
Guruh: 070-19
Fan: Ma'lumotlar tuzilmasi va algoritmi
O'qituvchi: Shoraimov Husanboy
Talaba: Abdrimov Sanjar
Variant: 1-variant
1. Massivning manfiy min va musbat min elementlari yig’indisini toping
#include
#include
using namespace std;
int main()
{
int a[10],arr[10];
int i,min2,min1;
float summ;
srand(time(0));
cout<<"Boshlang'ich massiv : ";
for (int j=0; j<10;j++){
a[j]=rand()%20-rand()%20;
cout<min1=a[0];
cout<<"Musbat sonlardan iborat massiv : ";
for (i=0; i<10; i++){
if (min1>a[i]) min1=a[i]; }
int j=0; for (i=0; i<10; i++){
if (a[i]>=0){
arr[j]=a[i]; cout<<" "< j++;}}
cout<Download 1.29 Mb.
Do'stlaringiz bilan baham:




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