Kompyuter injiniring fakultеti 912-21 guruh talabasi axmedov abrorning


Download 72.52 Kb.
bet2/2
Sana19.06.2023
Hajmi72.52 Kb.
#1618731
1   2
Bog'liq
Документ Microsoft Word

Har bir iteratsiyada:Agar ikki qo’shni element noto’g’ri tartibda joylashib qolgan bo’lsa, ularning o’rnini almashtiramiz.
Elementlar o’z o’rinlariga pufakga o’xshab siljib boradi


DASTUR KODI
#include
using namespace std;
int main() {
int n;
cin>>n;
int a[n];
for (int i = 0; i < n; i++)
cin>>a[i];
for (int i = n-1; i >= 1; i--) {
for (int j = 0; j < i; j++) {
if (a[j] > a[j+1]) {
int t = a[j];
a[j] = a[j+1];
a[j+1] = t;
}
}
}
for (int i = 0; i < n; i++)
cout<return 0;
}
NATIJA:


TRANSENDET TENGLAMA ILDIZI YOTGAN ORALIQNI ANALITIK USULDA ANIQLASH(1 misol)
2x3+3x2-12x-9=0


BLOK-SXEMASI

DASTUR KODI:
#include
#include
#include
using namespace std;
double function (double x){
return 2*x*x*x+3*x*x-12*x-9; }
int main(){
double a,b;
float e=0.0001;
do{
cout<<"a=";
cin>>a;
cout<<"b=";
cin>>b;
} while(function(a)*function(b)>=0);
do {
double c=(a+b)/2;
if(function(a)*function(c)<0){
b=c;
} else a=c;
} while(b-a>e);
double c=(a+b)/2;
cout<NATIJA:


TRANSENDENT TENGLAMA ILDIZI YOTGAN ORALIQNI GRAFIK USULDA TOPISH:(1 MISOL)

5COS(X)-2X-3=0

ANIQ INTEGRALNI TO’RTBURCHAKLAR USULI BILAN HISOBLASH: (3ta misol)

Chap to’rtburchaklar usuli:
integralni qiymatini hisoblash uchun [a, b] oraliqni Nta teng bo’lakka bo’lib, integrallash qadami aniqlanadi: h=(b-a)/N
Keyin quyidagilar hosil qilinadi:
X0 = a ; X1 = a + 1h; X2 = a + 2h; X3 = a + 2h; … XI = a + ih; … XN = b.



Dastur kodi:
#include
#include
#include
using namespace std;
double funksiya(double x){
float func=x/sqrt(x*x+1);
return func;
}
int main(){
double a,b,n;
float h,s,x;
cout<<"a=";
cin>>a;
cout<<"b=";
cin>>b;
cout<<"Bo'laklar soni: n=";
cin>>n;
h=(b-a)/n;
s=0;
for(int i=0;i float x=a+h/2+(i-1)*h;
s+=funksiya(x);
}
s=s*h;
cout<<"S="<}
Natija:


O’RTA QIYMATLI TO’RTBURCHAKLAR USULI:
BLOK-SXEMA:


#include
#include
using namespace std;
double funksiya(double x){
float func=x/sqrt(x*x+1);
return func;}
int main(){
double a,b,n;
float h, s, x;
cout<<"a=";
cin>>a;
cout<<"b=";
cin>>b;
cout<<"Bo'laklar soni: n=";
cin>>n;
h=(b-a)/n;
x=a+h/2;
s=funksiya(x);
for(int i=1;i x=x+h;
s+=funksiya(x);
}
s=s*h;
cout<<"S="<}
NATIJA:


O’NG TO’RTBURCHAKLAR USULI:
MATEMATIK TAVSIFI:
[a, b] integrallash oralig’i N ta teng bo’laklarga bo’linadi. h = (b-a)/N.




X0 = b , X1 = b – 1h, X2 = b – 2h, … , XI = b – ih, … , XN = b – Nh = a.

Y0 = f(x0), Y1 = f(x1), Y2 = f(x2), … , Yi = f(xi), … , YN-1 = f(xN-1),

xi = b-ih, i = 0,1, …, N-1.

Si = hf(xi) , xi = b – ih , i = 0,1, … , N-1.

xi = b – ih , i = 1,2, … , N-1.
Blok-sxemasi:

DASTUR KODI:
#include
#include
#include
using namespace std;
double funksiya(double x){
float func=x/sqrt(x*x+1);
return func;
}
int main(){
double a,b,n;
float h, s, x;
cout<<"a=";
cin>>a;
cout<<"b=";
cin>>b;
cout<<" Bo'laklar soni: n=";
cin>>n;
h=(b-a)/n;
s=0;
for(x=a+h/2;x s+=funksiya(x);
}
s=s*h;
cout<<"S="<}
NATIJA:

CHIZIQLI PROGRAMMALASH MASALASINI SIMPLEKS USULIDA OPTIMAL YECHISH(1 misol)



YECHIMI


TAJRIBANI REJALASHTIRISHNING 2K-REJA USULI(1 misol)
Texnologik jarayonni 3 faktorli to’liq chiziqli modeli 2k-reja usulida qurilsin
Malumotlar: Y=(2,5,7,9,8,5,3); Z1=100-160; Z2=30-40; Z3=50-60.
YECHIMI:


Download 72.52 Kb.

Do'stlaringiz bilan baham:
1   2




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