1-chiziqli algaritmlar


Download 406.13 Kb.
Sana18.01.2023
Hajmi406.13 Kb.
#1099172
Bog'liq
1 - amaliy mashgulot


1-chiziqli algaritmlar

  1. O`lchami x bo`lgan qubik berilgan. Uning hajmini toping.


Tamom

V=x*x*x

x

boshlash

#include


#include


using namespace std;

int main()


{ double a ,V;
cin>>x;
V=pow(x,3);
cout<

  1. Radyuslari r1, r2, r3 bolgan 3 to doira radyuslari berilgan. Doiralarni yuzini hisoblang.

#include

#include
using namespace std;

int main()


{ double r1 ,r2 ,r3 ,S1, S2 , S3 ;
cin>>r1>>r2>>r3;

Tamom

S1=
S2
S3

r1 , r2 , r3

boshlash
S1= M_PI*pow(r1 ,2);
S2= M_PI*pow(r2 ,2);
S3= M_PI*pow(r3 ,2);
cout<


  1. Yuzasi s va balandligi h bo`lgan uch burchag berilgan. Uni asosini toping.


Tamom

a=S/h

S, h

boshlash
#include
#include
using namespace std;
int main()
{ double S , a, h;
cin>>S>>h;
a =S/h;
cout<

Tamom

s

r

boshlash

  1. Radyusi r bo`lgan sharing yuzini toping.

#include
#include
using namespace std;
int main()
{ double r , S ;
cin>>r;
S=M_PI*4*r*r;
cout<


  1. a,b va c tamonli uch burchag berilgan. Uch burchagning pirimetiri topilsin.


boshlash

a, b ,c

P=a+b+c

Tamom
#include
#include
using namespace std;
int main()
{ double a, b, c , P ;
cin>>a>>b>>c;
P= a+b+c;
cout<

  1. Asoslari a va b, balandligi h bo`lgan g`ola yuzini toping.


Tamom

S=2ab+2bh+2ah

a, b ,h

boshlash
#include
#include
using namespace std;
int main()
{ double a, b, h ,S;
cin>>a>>b>>h;
S= 2*a*b+2*b*h+2*a*h;
cout<

  1. Qo`nisning balandligi h va radyusi r bo`lsa uning hajmi nimaga teng bo`ladi.


Tamom

V= h/3

a, h

boshlash
#include
#include
using namespace std;
int main()
{ double h,r ,V ;
cin>>h>>r;
V= M_PI*r*r*h*1/3;
cout<

  1. Tezligi v bo`lgan avtomabil s masofani qancha vaqtda bosib o`tadi.


Tamom

T=s/v

S,v

boshlash
#include
#include
using namespace std;
int main()
{ double s, v, t ;
cin>>s>>v;
t=s/v;
cout<

Tamom

T=

H, g=9.81

boshlash

  1. h balandlikqan erkin tushayotgan jism qancha vaqtdan keyin erga uriladi.

#include
#include
using namespace std;
int main()
{ double g=9.81 , h ,t;
cin>>h;
t=sqrt(2*h/g);
cout<


Tamom

V=x*365*0,001*24*60*60

x

boshlash

  1. Jo`mrakdan 1 s da 1 milli litr suv tomsa x yilda necha litr suv tomadi.

#include
#include
using namespace std;
int main()
{ double x ,V;
cin>>x;
V= x* 0.001*365*24*60*60;
cout<

Tamom

P=m*g

M, g=9.81

boshlash

  1. A,B,C sonlar berilgan A ning qiymati B ga, B ning qiymati C ga, C ning aiymati A ga almashtirilsin.

  2. Massasi m bo`lgan jismni og`irligini toping.

#include
#include
using namespace std;
int main()
{ double m , g=9.81, P ;
cin>>m;
P=m*g;
cout<


  1. m massali jismga a tezlanish berilganda unga qanchali kuch tasir qiladi.


Tamom

F=ma

m, a

boshlash
#include
#include
using namespace std;
int main()
{ double a, m, F ;
cin>>a>>m;
F=m*a;
cout<


  1. Tomoni a bo’lgan kvadrat berilgan uning peremetrini aniqlang.


Tamom

P=4a

a

boshlash
#include
#include
using namespace std;
int main()
{ double a, p;
cin>>a;
p=4*a;
cout<

  1. Tekislikda berilgan (x1,y1) va (x2,y2) nuqtalar orasidagi masofani toping.

#include

Tamom

d=sqrt(pow((x2-x1),2)+pow((y2-y1),2))

X1 ,x2,y2,y1

boshlash
#include
using namespace std;
int main()
{ double x1 ,y1 ,x2 ,y2, d ;
cin>>x1>>y1>>x2>>y2;
d=sqrt(pow((x2-x1),2)+pow((y2-y1),2));
cout<
2-tarmoqlanuvchi algaritmlar

  1. x va y son berilgan bu sonlarlar kattasini va kichigini topish algaritmini tuzing.

#include


#include
using namespace std;
int main()
{ double a ,b, k, m ;
cin>>a>>b;
k=max(a ,b);
m=min(a,b);
cout<<"kattasi:"<}




  1. x, y va z son berilgan bu sonlarlar kattasini va kichigini topish algaritmini tuzing.

#include


#include
using namespace std;
int main()
{ double a, b, c, k, m;
cin>>a>>b>>c;
k= max(a, max(b ,c));
m=min(a,min(b,c));
cout<<"kattasi:"<



  1. a,b,c sonlari berilgan bu sonlarni o’sish tartibida joylashtirish algaritmini tuzing.

#include


#include
using namespace std;
int main()

{
int a,b,c;


cin>>a>>b>>c;
if(a>b && b>c){
cout<if(a>c && c>b)
{
cout<}
if(b>a && a>c)
{
cout<}
if(b>c && c>a)
{
cout<}
if(c>b && b>a)
{cout<}
if(c>a && a>b)
{
cout<}
}






  1. a,b,c,d sonlari berilgan a soni b dan katta bo’lsa d bilan almashtiring aks xolda c bilan almashtiring.

#include
#include
using namespace std;
int main()
{ double a, b, c, d ;
cin>>a>>b>>c>>d;
if(a>b)
cout<else
cout<



  1. x, y , z haqiqiy musbat sonlar berilgan. x, y, z uzunlikka ega tomonli uchburchak mavjudmi?

#include
#include
using namespace std;
int main()
{ double x, y, z ;
cin>>x>>y>>z;
if(x+y>z && y+z>x && x+z>y)
cout<<"Ha , mumkin";
else
cout <<"yo'q" ; }




  1. a soni berilgan bu son musbatmi, toq sonmi yoki no’lga tengligini tekshirish algaritmini tuzing.



  1. Uznligi a va b bo’lgan (a>b) kesma berilgan, b kesma a kesmada necha marta joylashishi mumkin.


  1. Uchta son berilgan shu sonlar orasida nechta musbat va nechta manfiy son bor.

  2. a soni berilgan, bu son tub sonligini aniqlovchi algaritm tuzing.

  3. Markazi (x,y) nuqtada bo’lgan aylana berilgan, aylana markazi koordinatalar o’qining qaysi choragida joylashgan



#include


#include
using namespace std;
int main()

{ double a, b ,c, x, q;


cin>>a>>b>>c>>x;
if (a*b!=0)
{
q=(a*x*x+pow(b*c , 1./3))/(2*a*b);
cout<}
else
if(a>0)
{
q=(sin(x)*sin(x)+pow(b,3))/(log(a*x*x));
cout<}
else
cout<<"yoq"; }






#include
#include
using namespace std;
int main()

{ double a,b, c, x,y;


cin>>a>>b>>c>>x;
if(a<0)
{
y=(pow(sin(a*x),2)+pow(cos(a*x*x), 3))/(pow((a+b),2)+c);
cout<}
else
if(a*a>=b*b*b)
{

y=(sqrt(a*a-b*b)+2*a*c)/(sin(a)*sin(a)+b*x*x);


cout<else
cout<<"yooooq"; }





#include
#include
using namespace std;
int main()

{ double a ,b, c, x ,q , y;


cin>>a>>b>>c>>q>>x;
if(a>c)
{y=(2*pow(x,3)+a*x*x+pow(c,3))/(a*a-c*c);
cout<}
else
if(q!=0)
{
y= (2*a*b+sin(a*x*x))/sqrt(a*a+2*q*q);
cout<}
else


cout<<"shart bajarilmadi:"; }







#include
#include
using namespace std;
int main()

{ double a , b, c ,x , y ,d ;


cin>>a>>b>>c>>d>>x;
if (a>0)
{
y=(2*c*c+a*b*cos(x*x))/(a*sin(x*x)+pow(b,3));
cout<}
else
if(d!=0)
{
y= (a*a+2*b*pow(c,3))/sqrt(pow(a,3)+2*c*c+pow(d,3));
}
else
cout<<"Bunday shartlar bajarilmadi:"; }



3-Takrorlanuvchi algaritmlar



#include
#include
using namespace std;
int main()


{ float x,n;
cin>>n>>x;
double s=0;
for(int i=0 ; i<=n; i++)
s+=(pow(-1 ,n-1)*pow((x-1),n))/n;
cout<<"S="<
return 0;
}








#include
#include
using namespace std;
int main()


{ float x,n;
cin>>n>>x;
double p=0;
for(int i=0 ; i<=n; i++)
p+=(pow(-1,n)*pow(x, 2*n))/n;
cout<<"P="<

return 0;
}




#include
#include
using namespace std;
int main()


{ float x,n;
cin>>n>>x;
double s=0;
for(int i=0 ; i<=n; i++)
s+=pow(-1,n)*pow(x, 2*n);
cout<<"s="<
return 0;
}








#include
#include
using namespace std;
int main()


{ float x,n;
cin>>n>>x;
double s=0;
for(int i=0 ; i<=n; i++)
s+=(pow(-1,n-1)*pow(x, 2*n-1))/n;
cout<<"s="<
return 0;
}




#include
#include
using namespace std;
int main()


{ float x,n;
cin>>n>>x;
double s=0;
for(int i=0 ; i<=n; i++)
s+=pow(x, 2*n-1)/n;
cout<<"s="<
return 0;
}




#include
#include
using namespace std;
int main()


{ float x,n;
cin>>n>>x;
double p=0;
for(int i=0 ; i<=n; i++)
p+=(pow(x, 2*n-1)*pow(-1 ,n+1))/(2*n-1);
cout<<"p="<

return 0;
}






#include
#include
using namespace std;
int main()


{ float x,n;
cin>>n>>x;
double s=0;
for(int i=0 ; i<=n; i++)
s+=pow(x, 2*n-1)/(2*n-1);
cout<<"s="<
return 0;
}






#include
#include
using namespace std;
int main()


{ float n;
cin>>n;
double p=0;
for(int i=0 ; i<=n; i++)
p+=1/n;
cout<<"p="<

return 0;
}








#include
#include
using namespace std;
int main()


{ float n, k;
cin>>n>>k;
double s=0;
for(int i=0 ; i<=n; i++)
s+=(pow(k,n))/n;
cout<<"s="<
return 0;
}


















#include
#include
using namespace std;
int main()


{ float n;
cin>>n;
double s=0;
for(int i=0 ; i<=n; i++)
s+=pow(M_PI,(2*n+1))/(pow(10 ,(2*n+1)));
cout<<"s="<
return 0;
}








#include
#include
using namespace std;
int main()


{ float n;
cin>>n;
double s=0;
for(int i=0 ; i<=n; i++)
s+=M_PI/(pow(10 ,(2*n+1)));
cout<<"s="<
return 0;
}


  1. ,

Download 406.13 Kb.

Do'stlaringiz bilan baham:




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