Yechimi: Pascal tilida
Download 46.47 Kb.
|
Begin
Begin1. Kvadratningtomoni a berilgan. Uning perimetri aniqlansin. P=4*a Yechimi:
Pascal tilida
program m1; uses crt; var a,p:real; begin write('To`rtburchakning tomonini kiriting = '); read(a); p:=4*a; write('Perimetri = ',p); readkey; end. C++ tilida #include #include int main() { int a; cout<<"Kvadratning tomonini kiriting = "; cin>>a; int p=4*a; cout<<"Kvadratning perimetri = "< getch(); } Begin2. Kvadratningtomoni a berilgan. Uning yuzasi aniqiansin. S=a2 Yechimi: Pascal tilida Program begin2; uses crt; var a,S:real; begin write('To`rtburchakning tomonini kiriting = '); Read(a); S:=sqr(a); write('Yuza = ',S:2:2); readkey; end. C++ tilida #include #include int main() { int a; cout<<"To`rtburchakning tomonini kiriting = "; cin>>a; int s=a*a; cout<<"To`rtburchakning yuzi = "< } Begin3. To'g'ri to'rtburchakning tomonlari a va b berilgan. Uning yuzasi S = a * b; va P = 2 * (a + b) perimetri aniqiansin. Yechimi:
Pascal tilida
program m3; uses crt; var p,s,a,b:real; begin write('To`rtburchakning tomonlarini kiriting = '); write(‘a = ’); read(a); write(‘b = ’); read(b); s:=a*b; p:=2*(a+b); writeln('Yuzasi=',s); writeln('Perimetri=',p); readkey; end. C++ tilida #include #include int main() { int a; cout<<"To`rtburchakning tomonlarini kiriting = \n"; cout<<"a = "; cin>>a; int b; cout<<"b = "; cin>>b; int s=a*b; cout<<"To`rtburchakning yuzi = "< cout<<"To`rtburchakning perimetri = "< getch(); } Begin4. Aylananing diametri d berilgan. Uning uzunligi aniqiansin L=π*d. π = 3.14 Yechimi:
Pascal tilida
Program Begin4; Uses crt; var d,L:real; begin write(‘Aylananing diametrini kiriting = ’); read(d); L:=pi*d; write('Aylananing uzunligi = ', L:2:1); readkey; end. C++ tilida #include #include #include int main() { int d; cout<<"Aylananing diametrini kiriting = "; cin>>d; float l=3.141516*d; cout<<"Aylananing uzunligi = "< } Begin5. Kubning yon tomoni a berilgan. Uning hajmini V = a3 va to`la sirti S=6*a2 aniqlansin. Yechimi:
Pascal tilida
program begin5; uses crt; var a,v,s:real; begin write(‘Kubning tomonining uzunligini kiriting = ’); read(a); v:=exp(3*ln(a)); s:=sqr(a)*6; writeln('Kubning hajmi = ',v); writeln(' Kubning yuzasi = ',s); end. C++ tilida #include #include #include int main() { int a; cout<<"Kub tomonining uzunligini kiriting = "; cin>>a; float v=pow(a,3); cout<<"Kubning hajmi = "< cout<<"Kubning yuzi = "< } Begin6. Paralelepepidning tomonlari a, b, с berilgan. Uning hajmini V = a*b*c va to’la sirti S = 2*(a*b+b*c+a*c) aniqlansin. Yechimi:
Pascal tilida
program begin6; var a,b,c:integer; V,S:real; begin writeln(‘Paralelopipedning tomonlari uzunligini kiriting’); write('a = '); read(a); write('b='); read(b); write('c='); read(c); V:=a*b*c; writeln('v=',V:0:2); S:=2*(a*b+b*c+a*c); writeln('s=',S:0:2); end. C++ tilida #include #include #include int main() { int a,b,c; cout<<"Paralelopiped tomonlarining uzunligini kiriting\n"; cout<<"a = "; cin>>a; cout<<"b = "; cin>>b; cout<<"c = "; cin>>c; float v=a*b*c; cout<<"Paralelopipedning hajmi = "< cout<<"Paralelopipedning yuzi = "< } Begin7. Doiraning radiusi R berilgan. Uning uzunligi L va yuzasi S aniqiansin. L = 2 π R . S = π *R2 Yechimi:
Pascal tilida
program begin7; uses crt; var r,l,s:real; begin write(‘Aylananing radiusini kiriting = ’); read(r); l:=2*pi*r; writeln('Aylana uzunligi = ',l); s:=pi*sqr(r); writeln('Aylana yuzi = ',s); readkey; end. C++ tilida #include #include #include int main() { float R; cout<<"Aylananing radiusini kiriting = "; cin>>R; float L=2*M_PI*R; cout<<"Aylana uzunligi = "< cout<<"Aylana yuzi = "< } Begin8. Ikkita son a va b berilgan. Ularning o’rta arifmetigi aniqiansin. (a+b)/2 Yechimi:
Pascal tilida
Program begin8; var a,b,c:real; begin writeln(‘Ikki son kiriting:’); write('a='); read(a); write('b='); read(b); C:=(a+b)/2; write('Ikki sonning o`rta arifmetigi = ',c:0:2,’ ga teng’); readkey; end. C++ tilida #include #include #include int main() { cout<<"Ikki son kiriting:\n"; float a,b; cout<<"a = "; cin>>a; cout<<"b = "; cin>>b; float c=(a+b)/2; cout<<"Ikki sonning o`rta arifmetigi = "< } Begin9. Ikkita manfiy bo'Imagan son a va b berilgan. Ularning o'rta geometrigi aniqiansin. Yechimi:
Pascal tilida
program begin9; uses crt; var a,b,s:real; begin writeln(‘Ikki son kiriting:’); write('a='); read(a); write('b='); read(b); s:=sqrt(a*b); writeln('Ikki sonning o`rta geometrigi = ',s); readkey; end. C++ tilida #include #include #include int main() { cout<<"Ikki son kiriting:\n"; float a,b; cout<<"a = "; cin>>a; cout<<"b = "; cin>>b; float c=sqrt(a*b); cout<<"Ikki sonning o`rta geometrigi = "< } Begin10. Nolga teng bo'Imagan ikkita son berilgan. Ularning yig'indisini, ko’paytmasini va har birining kvadrati aniqiansin. Yechimi:
Pascal tilida
program begin10; uses crt; var a,b,s:real; begin writeln(‘Ikki son kiriting:’); write('a='); read(a); write('b='); read(b); s:=a+b; writeln('Ikki sonning yig`indisi = ',s); s:=a*b; writeln('Ikki sonning ko`paytmasi = ',s); s:=sqr(a); writeln('Birinchi sonning kvadrati = ',s); s:=sqr(b); writeln('Ikkinchi sonning kvadrati = ',s); readkey; end. C++ tilida #include #include #include int main() { cout<<"Ikki son kiriting:\n"; float a,b; cout<<"a = "; cin>>a; cout<<"b = "; cin>>b; float c=a+b; cout<<"Ikki sonning yig`indisi = "< cout<<"Ikki sonning ko`paytmasi = "< cout<<"Birinchi sonning kvadrati = "< cout<<"Ikkinchi sonning kvadrati = "< } Begin11. Nolga teng bo'Imagan ikkita son berilgan. Ularning yig'indisini, ko’paytmasini va har birining moduli aniqiansin. Yechimi:
Pascal tilida
program begin11; uses crt; var a,b,s:real; begin writeln(‘Ikki son kiriting:’); write('a='); read(a); write('b='); read(b); s:=a+b; writeln('Ikki sonning yig`indisi = ',s); s:=a*b; writeln('Ikki sonning ko`paytmasi = ',s); s:=abs(a); writeln('Birinchi sonning moduli = ',s); s:=abs(b); writeln('Ikkinchi sonning moduli = ',s); readkey; end. C++ tilida #include #include #include int main() { cout<<"Ikki son kiriting:\n"; float a,b; cout<<"a = "; cin>>a; cout<<"b = "; cin>>b; float c=a+b; cout<<"Ikki sonning yig`indisi = "< cout<<"Ikki sonning ko`paytmasi = "< cout<<"Birinchi sonning moduli = "< cout<<"Ikkinchi sonning moduli = "< } Begin12. To'gri uchburchakning katetlari a va b berilgan. Uning gipotenuzasi с va perimetri P aniqiansin. C= , P=a+b+c. Yechimi: Pascal tilida program begin12; uses crt; var a,b,c,p:real; begin writeln(‘Uchburchakning katetlarini kiriting:’); write('a='); read(a); write('b='); read(b); c:=sqrt(sqr(a)+sqr(b)); p:=a+b+c; writeln('Uchburchakning gepatenuzasi=',c:0:2,’ ga teng’); writeln('Uchburchakning perimetri = ', p:0:2,’ ga teng’); readkey; end.
C++ tilida
#include #include #include int main() { cout<<"Uchburchakning katetlarini kiriting:\n"; float a,b; cout<<"a = "; cin>>a; cout<<"b = "; cin>>b; float c=sqrt(pow(a,2)+pow(b,2)); cout<<"Uchburchakning gipatenuzasi = "< cout<<"Uchburchakning perimetri = "< } Begin13. Umumiy markazga ega bo'lgan ikkita aylana radiusi berilgan. R1,R2 (R1>R2).Ularnig yuzalari S1 va S2, ularning ayirmasi S3 aniqiansin. Sl = π R12, S2= π R22, S3 = π (R1-R2)2. Yechimi: Pascal tilida program begin13; uses crt; var r1,r2,s:real; begin writeln(‘Ikkita aylana radiuslarini kiriting:’); write('r1='); read(r1); write('r2='); read(r2); s:=pi*sqr(abs(r1-r2)); write('Yuza = ’,s:0:2); readkey; end. C++ tilida #include #include #include int main() { float r1,r2; cout<<"Ikkita aylana radiuslarini kiriting:"; cout<<"r1 = "; cin>>r1; cout<<"r2 = "; cin>>r2; float s=M_PI*pow(abs(r1-r2),2); cout<<"Yuza = "< } Begin14. Aylananing uzunligi L berilgan. Uning radiusi R va yuzasi S aniqiansin L = 2* π *R S = π R2 π = 3.14 Yechimi: Pascal tilida Program begin14; Uses crt; var L,R,S:real; begin write('Aylananing uzunligi L ni kiriting = '); read(L); R:=L/2*pi; S:=pi*R*R; writeln('Radius = ', R:0:2); writeln('Yuzasi = ', S:0:2); end. C++ tilida #include #include #include int main() { float L; cout<<"Aylananing uzunligi L ni kiriting = "; cin>>L; float R=L/2*M_PI; cout<<"Radiusi = "< cout<<"Yuzasi = "< } Begin15. Aylananing yuzasi S berilgan. Uning diametri d va radiusi R aniqiansin L = 2* π *R S = π R2 π = 3.14 Yechimi: Pascal tilida program begin15; uses crt; var r,d,s:real; begin write('Aylananing yuzasi S ni kiriting = '); read(s); r:=sqrt(s/pi); write(‘Aylananing radiusi ’,r,’ ga teng’); d:=2*r; writeln('Aylananing diametric ',d,’ ga teng’); readkey; end. C++ tilida #include #include #include int main() { float S; cout<<"Aylananing yuzasi S ni kiriting = "; cin>>S; float R=sqrt(S/M_PI); cout<<"Aylananing radiusi "< cout<<"Aylananing diametri "< } Begin16. Sonlar o'qida ikkita nuqta orasidagi masofa aniqiansin. |x1-x2| Yechimi: Pascal tilida Program begin16; Uses crt; Var s,x1,x2:real; begin writeln(‘Sonlar o`qida ikkita nuqta koordinatasini kiriting:’); write(‘x1 = ’); read(x1); write(‘x2 = ’); read(x2); s:=abs(x1-x2); write(‘Ikki nuqta orasidagi masofa ’,S,’ ga teng’); readkey; end. C++ tilida #include #include #include int main() { cout<<"Sonlar o`qida ikkita nuqta koordinatalarini kiriting:"; float x1,x2; cout<<"x1 = "; cin>>x1; cout<<"x2 = "; cin>>x2; float s=abs(x1-x2); cout<<"Ikki nuqta orasidagi masofa "< } Begin17. Sonlar o'qida А, В, С nuqtalar berilgan. AC va BC kesmalarning uzunligini va kesmalar uzunligining yig'indisini topuvchi programma tuzilsin. Yechimi: Pascal tilida Program begin17; uses crt; var a,b,s,as,bs,ss:real; begin writeln(‘Sonlar o`qida uchta nuqta koordinatalarini kiriting’); write('a='); read(a); write('b='); read(b); write('s='); read(s); as:=abs(a-c); writeln(‘A va S nuqtalar orasidagi masofa ’,as,’ ga teng’); bs:=abs(b-s); writeln(‘B va S nuqtalar orasidagi masofa ’,bs,’ ga teng’); ss:=as+bs; writeln(‘AS va AS chiziqlar uzunliklari yig`indisi ’,ss,’ ga teng’); readkey; end. C++ tilida #include #include #include int main() { float a,b,s; cout<<"Sonlar o`qida uchta nuqta koordinatalarini kiriting\n"; cout<<"a = "; cin>>a; cout<<"b = "; cin>>b; cout<<"s = "; cin>>s; float as=abs(a-s); cout<<"A va S nuqtalar orasidagi masofa "< cout<<"B va S nuqtalar orasidagi masofa "< cout<<"AS va AS chiziqlar uzunliklari yig`indisi "< } Begin18. Sonlar o'qida А, В, С nuqtalar berilgan. С nuqta A va В nuqtalar orasida joylashgan. AC va BC kesmalar uzunligining ko'paytmasini toping. Download 46.47 Kb. Do'stlaringiz bilan baham: |
ma'muriyatiga murojaat qiling