Lab. 1-jadval 7-misol


Download 0.87 Mb.
bet2/3
Sana14.12.2020
Hajmi0.87 Mb.
#167197
1   2   3
Bog'liq
das lab 7


4-JADVAL 7-MISOL

N olchamga ega (n>0), haqiqiy sonli a massivni quyidagi korinishda silliqlashni bajaruvchi Smooth2(n,a) nomli void turidagi funksiya tasvirlansin: Massivdagi ak(k=2,…,n) element ak-1 va ak elementlarining yarim yigindisi bilan almashtirilsin. Bufunksiya yordamida berilgan a massivda 5 karra lisilliqlash bajarilsin va har bir silliqlash jarayoni chopetilsin.

#include

using namespace std;

void aa(double m[], int c){

double sum;

double m_temp[c];

for( int i=0; i

sum=0;


m_temp[i]=m[i];

if(i>0){

for(int j=0; j<(i+1); j++){

sum+=m_temp[j];

}

m[i]=sum/(i+1);



}

cout<<"m["<

}

}

int main(){



cout<<"elementlar soni:"<

int c;


cin>>c;

double m[c];

for(int i=0; i

cout<<"m["<

cin>>m[i];

}

cout<

aa(m,c);

cout<

cout<

aa(m,c);

cout<

cout<

aa(m,c);

cout<

cout<

aa(m,c);

cout<

cout<

aa(m,c);

}

Download 0.87 Mb.

Do'stlaringiz bilan baham:
1   2   3




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