Guruh talabasi Narziyev Axmadbek


Download 105.76 Kb.
Sana14.11.2021
Hajmi105.76 Kb.
#174234
Bog'liq
Документ Microsoft Word (2)


313-20-guruh talabasi

Narziyev Axmadbek



6-Laboratoriya ishi

1. massiv berilgan. ,  formulaga binoan yangi massiv hosil qiling va chop eting.

#include

#include

#include

#include

using namespace std;

int main(){

float n=6;

float a[]={1.2, 1.7, 3.5, 1.6, 4.9, 2.1};

cout<<"Berilgan a[] massiv elementlari: \n\n "<

for(int j=0; j

{

cout<

cout<

float b[]={9.2, 7.8, 8.3, 3.5, 5.7,7.3};

cout<<"Berilgan b[] massiv elementlari: \n\n "<

for(int l=0; l

{

cout<

cout<

float x[6];

for(int i=0; i<6; i++)

x[i]=(a[i]+b[i])/3-sqrt(a[i]*b[i])/4;

cout<<"Yangi hosil qilingan x[i] massiv elementlari: \n\n" ;

for(int i=0; i<6; i++)

cout<

system("pause");



return 0; }

2. X(N) massivining o‘rta arifmetik va o‘rta geometrik qiymatlarini aniqlang. X massivining o‘rta arifmetik qiymatidan katta va o‘rta geometrik qiymatdan kichik bo‘lgan elementlar sonini aniqlang va chop eting.

#include

#include

#include

#include

using namespace std;

int main(){

srand(time(NULL));

int a[100];

int n; cout<<"Massiv o'lchamini kiriting = "; cin>>n;

for(int i=0; i

{a[i]=rand()%101; cout<

int t=0;

for(int i=0; i

cout<<"\n";

cout<< "O'rta Arifmetigi" <<" " ;

float sum=0;

for (int i = 0; i

sum = sum + a[i];}

cout<< sum/n <<"\n" <

cout<<"O'rta geometrigi"<<" " ;

double T=1;

for (int i = 0; i

T*=a[i];}

cout<< pow(T,1./n)<<"\n" <

for(int i=0; i

if(a[i]pow(T,1./n) ) t++;

cout<<" Shartni bajaruvchi " <

cout<<"\n"; main(); }



3. x=(x1,…,xn) massivining birinchi 5ta musbat elementlarini Y=(y1, y2, …, y5) massiviga ketma ket yozing.



ni hisoblang.

#include

using namespace std;

int main(){

int n;

cout << "Massivning elementlari sonini kiriting" << endl;



cin >> n;

int massive[n];

int i=0;

while (i

{

cout << i+1 << "-elementni kiriting ";



cin >> massive [i];

i++;


};

i=0;


int j=0, yigindi=0;

int massive2[n];

while (i<5)

{

massive2[j] = massive[i]; yigindi=yigindi+massive2[j]; j++; i++; };



cout << endl << yigindi << endl<< "Dastur tugadi";

system ("pause");



return 0;

}

4.


a = {1,2; 1,7; 3,5; 1,6; 4,9; 2,1},b= {9,2; 7,8; 8,3; 3,5; 5,7;7,3}

(i=1,…,6). Ik



kita massiv berilgan.formula asosida X massivini hosil qiling va chop eting.

#include

#include

#include

#include

using namespace std;

int main(){

float n=11;

float z[]={0.1,7.5,1.1,0.26,0.13,14,2.5,8,0.75,0.01,3.4};

cout<<"Berilgan z[] massiv elementlari: \n\n "<

for(int j=0; j

{

cout<

cout<

float Y[11];

for(int n=0; n<11; n++)

Y[n]=z[n]/log10(z[n]);

cout<<"Yangi hosil qilingan Y[n] massiv elementlari: \n\n";

for(int n=0; n<11; n++)

cout<

system("pause");



return 0;

}


Download 105.76 Kb.

Do'stlaringiz bilan baham:




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