Chiziqli jarayonlarga oid masalalar
Download 0.71 Mb.
|
Dasturlash 1
- Bu sahifa navigatsiya:
- Tarmoqlanuvchi jarayonlar
Chiziqli jarayonlarga oid masalalar //1-masala. Mualllif: Norkulov Daler #include #include using namespace std; int main() { float a,b,c,S,P,p; int x1,y1,x2,y2,x3,y3; cout<<"kordinatalarnikiriting"< cout<<"y1="; cin>>y1; cout<<"x2=";cin>>x2; cout<<"y2="; cin>>y2; cout<<"x3=";cin>>x3; cout<<"y3=";cin>>y3; a=sqrt((x2-x1)*(x2-x1) +(y2-y1)*(y2-y1)); b=sqrt((x3-x2)*(x3-x2) +(y3-y2)*(y3-y2)); c=sqrt((x1-x3)*(x1-x3) + (y1-y3)*(y1-y3)); P=a+b+c; p=P*0.5;
S=sqrt(p*(p-a)*(p-b)*(p-c)); cout<<"P="< return 0; } //2-masala. Mualllif: Norkulov Daler #include #include int main() { float r,R; cout<<"kichik radiusni kiriting"< R=sqrt(2)*r; cout<<"R="< //3-masala. Mualllif: Norkulov Daler #include #include using namespace std;
int main() {
float a,b,c,x,y; return 0; #include #include using namespace std; int main()
{
int a,b,c,p,s; c=sqrt(a*a + b*b); p=a+b+c; s=(a*b)*1./2 ; cout<<"P="< return 0; } //5-masala. Mualllif: Norkulov Daler #include #include using namespace std; int main() { float a,b,c,S,P,p; int x1,y1,x2,y2,x3,y3; cout<<"Uchburchak kordinatalarini kiriting"< cout<<"y1="; cin>>y1; cout<<"x2="; cin>>x2; cout<<"y2="; cin>>y2; cout<<"x3="; cin>>x3; cout<<"y3=";cin>>y3; a=sqrt((x2-x1)*(x2-x1) +(y2-y1)*(y2-y1)); b=sqrt((x3-x2)*(x3-x2) +(y3-y2)*(y3-y2)); c=sqrt((x1-x3)*(x1-x3) + (y1-y3)*(y1-y3)); P=a+b+c; p=P*0.5; S=sqrt(p*(p-a)*(p-b)*(p-c)); cout<<"P="< return 0; } //6-masala. Mualllif: Norkulov Daler #include #include using namespace std; int main() { float r,s,l; cout<<"Radiusni kiriting"< s=M_PI*r*r; cout<<"Aylananing uzunligi="< return 0; } //7-masala. Mualllif: Norkulov Daler #include #include using namespace std; int main() { float a,b,h; cout<<"Katetlarni kiriting"< cout<<"b="; cin>>b; h=(a*b)/(sqrt(a*a+b*b)); cout<<"h="< //8-masala. Mualllif: Norkulov Daler #include #include using namespace std;
int main() {
float a,b,c,e; cout<<"O'rta arifmetigining kubi: "< //9-masala. Mualllif: Norkulov Daler #include #include using namespace std;
int main() {
float a,b,c,meda,medb,medc; cout<<"Tomonlarnikiritng"< meda=0.5*(sqrt(2*(b*b + c*c)-a*a)); medb=0.5*(sqrt(2*(a*a +c*c)-b*b)); medc=0.5*(sqrt(2*(a*a +b*b)-c*c)); cout<<"a tomonga tushirilgan mediana: "< return 0; //10-masala. Mualllif: Norkulov Daler #include #include using namespace std;
int main() {
float h,r,v; cout<<"R="; cin>>r; v=M_PI*r*r*h; cout<<"V="< //11-masala. Mualllif: Norkulov Daler #include #include using namespace std;
int main() {
float a,b,c,s,r,p; cout<<"b="; cin>>b; cout<<"c="; cin>>c; p=(a+b+c)*0.5; r=(sqrt(p*(p-a)*(p-b)*(p-c)))/p; s=M_PI*r*r; cout<<"Uchburchakka ichki chizilgan aylananing yuzi "< //12-masala. Mualllif: Norkulov Daler #include #include using namespace std;
{ floata,r; cout<<"Vatar va radiusnikiriting"< cout<<"R=";cin>>r; cout<<"Aylana maydoni sektor maydonidan "<<(M_PI*r)/(r*0.5*(2*asin(a/(2*r))-(a/r)*sqrt(1- (a/(2*r))*(a/(2*r)))))<<" marta katta"; return 0; } //13-masala. Mualllif: Norkulov Daler #include #include using namespace std; int main() { float s,r,n,S; cout<<"Kvadratning yuzini kiriting "< r=(sqrt(s)*0.5); S=r*r; n=s/S; cout<<"Kvadratga ichki chizilgan aylanaga ichki chizilgan kvadratning yuzi "< cout<<"Berilgan kvadratning yuzidan ichki chizilgan kvadratning yuzi: "< return 0; } Tarmoqlanuvchi jarayonlar //14-masala. Mualllif:.. Norkulov Daler #include using namespace std; int main() { int a,b,c; cout<<"Sonlarni kiriting"< if(a>0 && b>0 && c>0) cout<<"3 tasi musbat"; if(a>0 && b>0 && c<=0) cout<<"2 tasi musbat"; if(a>0 && b<=0 && c>0) cout<<"2 tasi musbat"; if(a<=0 && b>0 && c>0) cout<<"2 tasi musbat"; if(a<0 && b<0 && c<0) cout<<"birortasi ham musbat emas"; if(a>0 && b<=0 && c<=0) cout<<"bittasi musbat"; if(a<=0 && b<=0 && c>0) cout<<"bittasi musbat"; if(a<=0 && b>0 && c<=0) cout<<"bittasi musbat"; return 0; } //15-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { float o,m,b,n; cout<<"Qiymatlarni kiriting"< if(o>0 && m>0 && b>0 && n>0) { if((o*m)>(b*n)) cout<<"olmaga ko'proq pulsarflangan"; if((o*m)<(b*n)) cout<<"olmaga ko'proq pul sarflangan"; if((o*m)==(b*n)) cout<<"ikkalasigi ham teng pul sarflangan"; }
#include using namespace std; intmain() { inta,b; cout<<"Qiymatlarni kiriting"< if(a>=0 && b>0) { if(b%a==0) cout<<"2a="<<2*a< else
cout<<"b/2="<} else cout<<"Xatto raqam!!"; return 0; } //17-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { float v1,v2,m1,m2,p1,p2; cout<<"Hajm va og'irliklarni kiriting"< cout<<"m1="; cin>>m1; cout<<"V2="; cin>>v2; cout<<"m2="; cin>>m2; p1=m1/v1; p2=m2/v2; if(p1>p2) cout<<"birinchi jismning zichligi katta"; else if(p1 cout<<"ikkinchi jismning zichligi katta"; else if(p1==p2) cout<<"ikkala jismning ham zichligi bir xil"; return 0; } //18-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int n,a,s,a1,a2; cout<<"ikki xonali son kiriting: "; cin>>n; cout<<"a="; cin>>a; a1=n/10; a2=n%10; s=a1+a2; if(3%s==0) {cout< {cout< {cout<<"raqamlar yig'indisi "<
{cout<<"raqamlar yig'indisi "<
//19-masala. Mualllif: Norkulov Daler #include using namespace std; int main()
{
int n,n1,n2,n3,n4,s,p; cout<<"n="; cin>>n; n1=n/1000; n2=(n/100)%10; n3=(n/10)%10; n4=n%10; cout<<"1- va 2- raqamining yig'indisi,oxirgi ikki raqamining yig'indisiga teng"< else
cout<<"1- va 2- raqamining yig'indisi,oxirgi ikki raqamining yig'indisiga teng emas"< cout<<"raqamlar yig‘indisi 3 ga karrali"< cout<<"raqamlar yig'indisi 3 ga karrali emas"< cout<<"raqamlar ko‘paytmasi 4 karrali"; else //20-masala. Mualllif: Norkulov Daler #include using namespace std; int main()
{
//21-masala. Mualllif: Norkulov Daler #include using namespace std; int main()
{
//22-masala. Mualllif: Norkulov Daler #include using namespace std; int main()
{
float a,b,c; if(a>0 && b>0 && c>0 &&(a+b>c)&&(a+c>b)&&(b+c>a)) {
if((a*a+b*b==c*c)||(b*b+c*c==a*a)||(c*c+a*a==b*b)) cout<<"to'g'ri burchakli uchburchak"< }
else
}
float a,b; cout<<"a burchakni kiriting: ";cin>>a; cout<<"b burchakni kiriting: ";cin>>b; if((a+b)<180) { if((a==90 && b<90) || (b==90 && a<90) || ((a+b)==90)) cout<<"uch burchak to'g'ri burchakli"; else cout<<"uch burchak to'g'ri burchakli emas"; }
//23-masala. Mualllif: Norkulov Daler #include #include using namespace std; int main() { float a,b,c; cout << "Nuqtalarni kiriting" < cout << "b=";cin>>b; cout << "c=";cin>>c; if(fabs(a-b)>fabs(a-c)) cout<<"a nuqtaga c nuqta yaqin"; else if(fabs(a-b) bo'lgan masofa teng";
if(b==c&&c==d&&a!=b) cout<<"uchta raqami bir xil"; else if(a==c&&c==d&&b!=c) cout<<"uchta raqami bir xil"; else if(a==b&&b==d&&c!=d) cout<<"uchta raqami bir xil"; else if(a==b&&b==c&&d!=a) cout<<"uchta raqami bir xil"; else cout<<"uchta raqami bir xil emas";
}
return 0; } //24-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { float a,b,c,n; cout<<"Sportchilarni natijasinikiriting"< cout<<"2-sportchining natijalarini kiriting:"; cin>>b; cout<<"3-sportchining natijalarini kiriting:"; cin>>c; if(a cout<<"3-sportchi g'olib"; else if(c
else if(c==a&&a==b&&c==b) cout<<"durrang!"; //25-masala. Mualllif: Norkulov Daler #include using namespace std; int main()
{
int n,a,b,c,d; cout<<"n="; cin>>n; a=n/1000; b=(n/100)%10; c=(n/10)%10; d=n%10; {
//26-masala. Mualllif: Norkulov Daler using namespace std; int main() { float a,b,c; cout<<"Qiymatlarni kiriting"< cout<<"maxsimal qiymat: "< //27-masala. Mualllif: Norkulov Daler #include using namespace std; int main()
{
char n; switch(n) { case '.':cout<<"Bu nuqta";break; case ',':cout<<"Bu vergul";break; case '!':cout<<"Bu undov";break; case '?':cout<<"Bu so'roq";break; case ';':cout<<"Bu nuqtali vergul";break; case '...':cout<<"Bu ko'p nuqta";break;
case '-':cout<<"Bu tire";break; case '()':cout<<"Bu qavs";break; case '""':cout<<"Bu qo'shtirnoq";break; default:cout<<"bunday belgi ro'yxatimizda yo'q!!"; }
} else if(a==c&&c==d&&b!=c) cout<<"uchta raqami bir xil"; else if(a==b&&b==d&&c!=d) cout<<"uchta raqami bir xil"; else if(a==b&&b==c&&d!=a) cout<<"uchta raqami bir xil"; else cout<<"uchta raqami bir xil emas"; } else
cout<<"xato son!"; return 0; }
//28-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int n; cout<<"n ni kiriting"< { case 0:cout<<"zero";break; case 1:cout<<"one";break; case 2:cout<<"two";break; case 3:cout<<"three";break; case 4:cout<<"four";break; case 5:cout<<"five";break; case 6:cout<<"sex";break; case 7:cout<<"seven";break; case 8:cout<<"eight";break; case 9:cout<<"nine";break; default:cout<<"(0-9) oralig'idagi musbat butun sonlarni kiriting!"; } return 0; } //30-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int y,o,y1,o1,ny,no; cout<<"Ma'lumotlarni kiriting"< { ny=y1-y; no=o-o1; if(no<=0) cout<<"yoshingiz "< cout<<"yoshingiz "< else
} //29-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int n,a,b,c,d; cout<<"n in kiriting(999 a=n/1000; b=(n/100)%10; c=(n/10)%10; d=n%10; if(n>999&&n<10000) { if(b==c&&c==d&&a!=b) cout<<"uchta raqami bir xil"; //31-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int n,n1,n2,a,b; cout<<"n ni kiriting"< { n1=n/10; n2=n%10; a=4*((n1*n1*n1)+(n2*n2*n2)); b=n*n; if(a==b)
cout<<"javob o’rinli"; else cout<<"javob o’rinsiz"; } else
cout<<"xato son!"; return 0; } //32-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int i=100,a,b,c; while(i<=999) { a=i/100; b=(i/10)%10; c=i%10; if(a==c) cout< }
} //33-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int n,e,b,c,s,p,a; cout<<"n va a nikiriting"< e=n/100; b=(n/10)%10; c=n%10; s=e+b+c; p=e*b*c; if(s>9&&s<100) cout< cout< if (p>99&&p<1000) cout< cout< cout<<"2 ta raqam bir xil"; if(n1==n3 && n1!=n2) cout<<"2 ta raqam bir xil"; if(n2==n3 && n1!=n2) cout<<"2 ta raqam bir xil"; if(n1!=n2 && n2!=n3 && n3!=n1) cout<<"birorta raqam bir xil emas";
}
//35-masala. Mualllif: Norkulov Daler #include using namespace std; int main()
{
int n,e,b,c,d,s,p,a; cout<<"a="; cin>>a; e=n/1000; b=(n/100)%10; c=(n/10)%10; d=n%10; s=e+b+c+d; p=e*b*c*d; if(e+b==c+d)
cout< else if(!(e+b==c+d)) cout< if (3%s==0) cout< cout< cout< cout< if(p%a==0)
cout< else if(!(p%a==0))
cout< return 0;
cout<<"A nuqta kordinatalarini kiriting"< cout<<"y1=";cin>>y1;
cout<<"B nuqta kordinatalarinikiriting"< cout<<"y2="; cin>>y2; a=sqrt(x1*x1+y1*y1); b=sqrt(x2*x2+y2*y2); if(a>b)
cout<<"A nuqta koordinata boshiga nisbattan yaqinroq joylashgan"; if(a==b)
cout<<"A nuqta ham B nuqta ham koordinata boshiga nisbattan bir xil uzoqlikda joylashgan "; if(a
cout<<"B nuqta koordinata boshiga nisbatan yaqinroq joylashgan"; } //36-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { float a,b,c; cout<<"sonlarni kiriting"< if(a>0) cout<<"a^4="<0) cout<<"b^4="<0) cout<<"c^4="< #include using namespace std; int main() { float a,b,c; cout<<"uchburchakning a burchagini kiriting: "; cin>>a; cout<<"uchburchakning b burchagini kiriting: "; cin>>b; c=180 - (a+b); if(a+b<180 && a>0 && b>0) { if(a==90 || b==90 || c==90) cout<<"uchburchak to'g'ri burchakli uchburchak"; else cout<<"uchburchak to'g'ri burchakli uchburchak emas"; } else
cout<<"bunday uchburchak mavjud emas!"; return 0; } } //37-masala. Mualllif: Norkulov Daler #include #include using namespace std; int main() { float x1,y1,x2,y2,a,b; //39-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { float a,b,x,y; cout<<"x va y ni kiriting"< cout<<"y="; cin>>y; a=2*x*y; b=(x+y)/2; if(x>y) { x=a; y=b; cout<<"x="< } else { y=a; x=b; cout<<"y="< }
cout< //42-masala. Mualllif: Norkulov Daler #include using namespace std; int main()
{
int s=0,x=10; {
s=s+x*x+x; }
//40-masala. Mualllif: Norkulov Daler #include using namespace std;
{ float x,y; cout <<" a nuqta kordinatalarini kiriting" << endl; cout<<"x=";cin>>x; cout<<"y=";cin>>y; if(x==0&&y==0)cout<<"a nuqta kordinata boshida joylashgan"; else if(x==0&&y!=0)cout<<"a nuqta y o'qida joylashgan"; else if(x!=0&&y==0)cout<<"a nuqta x o'qida joylashgan"; else if(x>0&&y>0) cout<<"a nuqta birinchi chorakda joylashgan"; else if(x<0&&y>0) cout<<"a nuqta ikkinchi chorakda joylashgan"; else if(x<0&&y<0) cout<<"a nuqta uchinchi chorakda joylashgan"; else if(x>0&&y<0) cout<<"a nuqta to'rtinchi chorakda joylashgan"; return 0; } //41-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int s=0,i; cout<<"yig'indi101+103+105+. +301 ="; for(i=101;i<=301;i=i+2) { s=s+i;
return 0; } //43-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int i=1,j=0; while(i<99) { i=i+2; j++; } cout<<"[1;100] oralig‘idagi toq sonlar n="< //44-masala. Mualllif: Norkulov Daler #include using namespace std; int main()
{
int i=12,n=0; while(i>10 && i<99) i=i+3; n++; } cout<<"n="< }
//45-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { cout<<"10 dan 50 gacha bo'lgan butun sonlar kvadratlarining yig'indisi "< { i++;
s=s+i*i; }
#include using namespace std; int main() { int i=12,j=0; while(i>10 && i<99) { i=i+3; j++; } cout<<" "< } //46-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { cout<<"10 dan 40 gacha bo'lgan butun sonlar kvadratlari: "< { i++;
s=i*i; cout<<" "< return 0; } //47-masala. Mualllif: Norkulov Daler #include #include using namespace std; int main() { int i,s;
cout<<"1 dan 50 gacha sonlarning kvadrat \n ildizi qiymatlari"< for(i=1;i<=50;i++) { cout<<" "< return 0; //49-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int i=15,j=0; cout<<"20 dan 500 gacha 5 ga bo'linadigan sonlar"< { i=i+5; j++; } cout<<"n="< //50-masala. Mualllif: Norkulov Daler #include using namespace std; int main()
{
int i=12,j=0; { i=i+3; j++; } cout<<"n="< } //51-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int main() {
int s=0,n; cout<<"n ni kiriting"< {
cout<<"n="; cin>>n; if (n > 0) {s += n;} cout<<"s="< //54-masala. Mualllif: Norkulov Daler #include #include using namespace std; int main() { int n,m,p,EKUK; cout<<"2 ta sonni EKUK ini aniqlash"< cout<<"m="; cin>>m; p=n*m; while(m) { n%=m; swap(n,m); n%=m; swap(n,m); }
//52-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int s=0,n; cout<<"n ni kiriting"< while(n)
{ s =s+ n % 2; n=n/2; } cout<<"ikkilik sonoq sestemasidagi birlar soni "< //53-masala. Mualllif: Norkulov Daler #include #include using namespace std; int main() { int a,b,EKUB; cout<<"2 ta o'zaro tub sonlarni aniqlash"< cout<<"b="; cin>>b; while(b) { a%=b; swap(a,b); EKUK=p/n; cout<<"EKUK="< //55-masala. Mualllif: Norkulov Daler #include using namespace std; int main()
{
int n,s=0,a=10,k=10,m,b,c; if(n>0)
{ m=n; c=n; for(int i=1;k<=m; i++) {
k=k*10; } cout<<"nollar soni "< else cout<<"n>0 bo'lishi kerak"; return 0; } } if(a!=1)
{ EKUB=a; cout<<"EKUB="< else cout<<"a va b soni o'zaro tub sonlar"; return 0; } //56-masala. Mualllif: Norkulov Daler #include using namespace std; int main() {
cout << "Natural son kiriting. Agar haqiqiy butun musbat son kiritilsa \n butun qismi bilan amallar bajariladi" << endl; cout<<"c="; cin>>c; if(c>0) {
cout<<"c="; cin>>c; if(c>0) n=c; while(n!=0) { if(n%10==7){a=a+(1+(n%10))*k; k=k*10;} if(n%10!=1&&n%10!=7&&n%10!=0){a=a+(n%10)*k;k=k*10;} if(n%10==0){a=a+n%10;k=k*10;} n=n/10; }cout< }
} //59-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int a=0,s=0,b,i=2,n,j; cout<<"n natural son bo'lishi kerak,\n haqiqiy musbat son kiritilsa uning butun qismi olinadi"< cout << "n="; cin>>n; if(n>=2) { while(i<=n) { j=1;
//57-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int a=1,b=1,c,n; cout<<"Fibonachi sonlari chiqariladi"< if(n<3) cout<
{
for(int i=3;i<=n;i++) c=a; a=b; b=a+c; cout<<" "< if(i%8==0)cout< }
//58-masala. Mualllif: Norkulov Daler #include using namespace std; int main() {
int n,a=1,b=1,c,k=1; cout<<"n ni kiriting"< { c=a; a=b; b=a+c; if(n==b){cout<<"n fibanachchi soni"; break;} if(n } return 0; while(j<=i) { if(i%j==0) { s=s+j;
} j++; } if(a } cout<<"x="<
}
return 0; } //60-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int s=0,n,i=1; cout<<"n ni kiriting"< { s+=i; i++; } cout<<"s="< } //61-masala. Mualllif: Norkulov Daler #include using namespace std; int main() {
cout << "juftlik "; while(i<=100) { y=i/(i-1); if(y==i)cout<
return 0; } //64-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int n=2,i=1,a; cout<<"a ni kiriting"< { n=n*2; i++; }
} //62-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int n,s=0,a; cout<<"n ni kiriting"< for(int i=1;i<=n;i++) { cout<<"a="; cin>>a; if(a<0) s+=a; }
//65-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int n,i=1,s=0,k,a; cout<<"n ni kiriting"< while(n!=0) { n=n/10; i=i*10; } cout<<" teskari ketma-ketlik"< while(k!=0)
{
//63-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { a=k%10;
s=s+a*i; k=k/10;
i=i/10; } cout< }
int i=2,k=1; long long int s=0,p=1; cout<<"a.progressiya2,3,5,8, "< do
{ } while(k<=10); cout<<"a. progressiyaning dastlabki 10 ta hadining ko'paymasi:p="< cout<<"a. progressiyaning dastlabki 10 ta hadining yig'indisi:s="< return 0; } //66-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int n,s=0,a,i=1; cout << "n=" ; cin>>n; cout< { while(i<=n) { int j=1; while(j
if(i%j==0) { s=s+j; } j++;
} if(s==i)
{ cout< } s=0; i++; }
else cout<<"n natural son bo'lishi kerak!"; return 0; } //69-masala. Mualllif: Norkulov Daler #include #include { float a,p; int n; cout<<"sonlarni kiriting"< p = a;
while (n-- && n) { p = p * (a + n); } cout<<"p="< return 0; }
//67-masala. Mualllif: Norkulov Daler #include using namespace std; int main() int i=100,a,b,c; for(i=101;i<=999;i++) { a=i/100; b=(i/10)%10; c=i%10;
if(a!=b&&b!=c&&a!=c) cout< } return 0; } //70-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int i=10,a=0,n; cout << "element qiymatini kiriting " << endl; cout<<"n="; cin>>n; while(i<=n) { i=i+10; a++; }cout<
} //67-masala. Mualllif: Norkulov Daler #include #include using namespace std; int main() { int n; float s=0; cout<<"n ni kiriting"< cout<<"n="; cin>>n; for(int i=0;i <=n;i++) { s+=pow ((-1),i)*pow (2,(-i)); } cout<<"s="< return 0; }
//71-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int n,i=1,m=1; cout << " Natija necha satir(n) bo'lsin" << endl; cout<<" n="; cin>>n; cout<<" Pifagor sonlari"< cout < cout<<" a^2"<<"+"<<"b^2"<<"="<<"c^2"< cout < while(i<=n)
{
m*=2; i++; } return 0; } //72-masala. Mualllif: Norkulov Daler #include using namespace std; intmain() { intk=0; for(int i=2;i<99,i<=999;i++) { for(int j=2;j*j<=i;j++) { if(i%j==0) { k=1;break; } } if(k==0) cout<
}
} //74-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int a,b,i,s=0,y=1,n; cout << "a dan b gacha(a cout<<"a="; cin>>a; cout<<"b="; cin>>b; if(a0) { while(a<=b) { int j=1; while(j<=a) { if(a%j==0) { s=s+j;
} j++;
} if(y else s=0; a++;
} cout<<"x="< katta son
}
else cout<<"shartga e'tibor bering"; //73-masala. Mualllif: Norkulov Daler using namespace std; int main() } { int i=1;
cout << "1 dan 100 gacha tub sonlar" << endl; cout << endl; while(i<=100) { //if(i==2)cout<
{ if(i%j==0&&i!=j) { break;
} if(i%j==0&&j==i)cout<<" "< } i++;
} return 0; } //75-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int n,i=100,s=0,n1,n2,n3; cout<<"n="; cin>>n; if(n>0&&n<=27) { while(i<=999) { n1=i/100; n2=(i%100)/10; n3=(i%100)%10; s=n1+n2+n3; if(s==n)cout< s=0; }
else cout<<" 0 return 0; } //76-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int i=100,a,b,c; for(i=101;i<=999;i++) { a=i/100; b=(i/10)%10; c=i%10;
if(a!=b&&b!=c&&a!=c) cout<} return 0; } //78-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int i,j,k; cout<<"10 ni kvadratlari yig'indisi 58 ga teng \n bo'lgan ikkita songa ajratish"< for(i=1,j=9;i<=5,j>=5;i++,j--) { if(i*i+j*j==58) cout<
return 0; } //79-masala. Mualllif: Norkulov Daler #include using namespace std; int main() {
//77-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int i=1,n,m; cout<<"n dan kichik va m bilan o'zaro tub bo'lgan barcha natural sonlar"< cout <<"n=";cin>>n; cout <<"m=";cin>>m; while(i<=n) { int j=2; while(j<=i) int a,b,c,d; for(int i=1023;i<=9999;i++) { a=i/1000; b=(i/100)%10; c=(i/10)%10; d=i%10; if(a!=b&&b!=c&&c!=a&&c!=d&&d!=a&&d!=b) cout< }
} { if(i%j==0&&m%j==0&&j!=i) { break;
} if(j==i&&i%j==0&&m%j==0) { break; } if(j==i&&i%j!=0&&m%j==0)cout< j++; }
} return 0; } //80-masala. Mualllif: Norkulov Daler //81-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int n,i=0,b,m=1,c,s=0; cout << "n ni kiriting" << endl; cout<<"n="; cin>>n; cout<<"a massivni elemenlari soni(c) qancha bo'lsin? \n Elemenlarni o'zingiz kiritasiz"< cout<<"c="; cin>>c; int a[c];
while(i {
cout<<"a massivni "< if(b>n){s=s+b;} } cout<<"yig'indi="< } //82-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int n=6,a[n]={1,2,3,4,5,6},i=0,k,b; cout<<"a[6]={1,2,3,4,5,6}"< cout<<"qaysi elementi(k) ko`chirilsin?"< cin>>k;
cout<<"qolgan elementlar"< while(i<6)
{
if(i!=k-1)cout<<" "<
}
//83-masala. Mualllif: Norkulov Daler #include using namespace std; int main()
{
int n,i=0,k,b,m=1,c; cout<<"c="; cin>>c; cout << "o'chirilishi kerak bo'lgan sonni kiriting " << endl; cin>>n;
int a[c]; while(i {
cout<<"a massivni "< i++;
i=0;
if(a[i]==n){k=i; b=i;} }
return 0; //84-masala. Mualllif: Norkulov Daler #include using namespace std; int main() { int a[10]={1,2,3,4,4,4,5,6,7,7},k=0; cout<<"berilgan massiv a[10]={1,2,3,4,4,4,5,6,7,7}"< int i=0;
while(i<10) { if(a[i]==a[i+1])k++; i++; }
//85(a)-masala. Mualllif: Norkulov Daler #include using namespace std; int main()
{
int n,i=0,c,b; cout<<" "; cin>>c; cout << " massiv elementlarini inter orqali kiriting" << endl;
int a[c]; while(i {
cout<<" "; cin>>b; i++;
cout< i=0;
while(i cout<<" "<
}
Download 0.71 Mb. Do'stlaringiz bilan baham: |
ma'muriyatiga murojaat qiling