# 3- amaliy mashg’ulot 1-chi masala qo’yilishi

Download 0,9 Mb.
 Sana 30.12.2021 Hajmi 0,9 Mb. #88672
Bog'liq
олавпаволпраолвпрлва

3- AMALIY MASHG’ULOT

1-chi masala qo’yilishi
 ; 1 a=1 b=2 c=3 Y=4.11 2 a=-2 b=3 c=7 Y=4.02

Dastur asosiy matni:

#include

#include

using namespace std;

int main()

{

float a=-2,b=3,c=7,x,Y;

x=(a*a-b)/c;

if(x<10)

{

Y=x*x+4;

cout<<"Y="<return 0;

}

x=(a*a-b)/c;

if(x>=10)

{

Y=x*x*x-7;

cout<<"Y="<

}

return 0;

}

2-chi masala

ax2+bx+c=0 tenglamaning haqiqiy ildizlarini topadigan yoki ildizi yo‘qligi haqida ma’lumot beradigan dastur tuzilsin.

Asosiy dastur matni:

#include

#include

int main()

{

int a,b,c;

float D,x1,x2,x3,x4,t,t1,t2,x;

cout<<"ax^4+bx^2+c=0 tenglama ildizini topish dasturi";

cout<<" a - koeffistientni kiriting ";

cin>>a;

cout<<" b - koeffistientni kiriting: ";

cin>>b;

cout<<" c - koeffistientni kiriting: ";

cin>>c;

x^2=t;

D = b*b – 4 * a * c;

if (D<0)

{

cout << "Tenglama haqiqiy ildizlarga ega emas";

return 0;

}

if (D==0)

{

cout << "Tenglama ikkita ildizga ega: " ;

t= -b / (2 * a);

cout<<"t=" <

x1=sqrt(t);

cout<<"x="<

x2=-sqrt(t);

cout<<"x="<

return 0;

}

if(D>0)

{

cout << "Tenglama ildizga ega: ";

t1 = (- b + sqrt(D)) / (2 * a);

if(t1<0,t2>0)

{

cout<<"Tenglama ikkita yechimga ega";

t2 = (- b - sqrt(D)) / (2 * a);

cout<<"t2=" <

x1=sqrt(t2);

cout<<"x="<

x2=-sqrt(t2);

cout<<"x="<

return 0;

}

if(t1==0,t2>0)

{

cout<<"tenglama uchta yechimga ega";

x1=0;

cout<<"x="<

x2=sqrt(t2);

cout<<"x="<

x3=-sqrt(t2);

cout<<"x="<

return 0;

}

if(t1>0,t2>0)

{

cout<<"tenglama to'rtta yechimga ega";

t1 = (- b + sqrt(D)) / (2 * a);

x1=sqrt(t1);

cout<<"x="<

x2=-sqrt(t1);

cout<<"x="x2;

t2 = (- b - sqrt(D)) / (2 * a);

x3=sqrt(t2);

cout<<"x="<

x4=-sqrt(t2);

cout<<"x="x4;

return 0;

}

}

return 0;

}

return 0;

}
Download 0,9 Mb.

Do'stlaringiz bilan baham:

Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2023
ma'muriyatiga murojaat qiling