Informatika-9-A,B. 28 – dars.
Mavzu: Chiziqli dasturlar tuzish mavzusini takrorlash
Maqsad: 1) ta’limiy: o`quvchilarga chiziqli dasturlar tuzishni o`rgatish;
2) tarbiyaviy: o`quvchilarga estetik tarbiya berish;
3) rivojlantiruvchi: o`quvchilarning dasturlash ko`nikmalarini rivojlantirish.
DTS: Chiziqli algoritmlarni dastur ko`rinishida yoza olish.
Darsning borishi
I. Tashkiliy davr
II. Takrorlash
Chiziqli dastur deganda nimani tushunasiz?
Qanday operatorlardan foydalanib muloqat dasturlari tuzish mumkin?
Nima uchun dasturda soniga qiymat berish shart emas?
Chiqarish formati haqida so‘zlab bering.
Ekrandagi natijani ko‘rish uchun qaysi klavishlar juftligi bosiladi?
III. Yangi mavzuni o`rganish
1. Quyida berilgan shakllarning shtrixlangan qismlarini yuzalarini hisoblash dasturini tuzing (yo’llanma: qanday shakl yuzasidan qaysi shakl yuzasini ayirish kerak?).
program yuza_1;
uses crt;
var s,a,r: real;
begin
write(‘Kvadrat tomoni uzunligini kiriting: ’); readln(a);
write(‘Doira radiusi uzunligini kiriting: ’); readln(r);
s:=a*a pi*sqr(r);
writeln(‘S=’,s:5:2,’ kvadrat birlik’);
readln;
end.
2. Boshlang‘ich tezligi vo bo‘lib, a tezlanish bilan tekis harakat qilayotgan moddiy nuqtaning t vaqt ichida bosib o‘tadigan yo‘lini aniqlash dasturini tuzing (yo’llanma: s=v0t+at2/2).
Program Masofani_hisoblash;
uses crt;
var s,v0,a,t: real;
begin
write(‘Boshlang`ich tezlikni kiritingni kiriting: ’); readln(v0);
write(‘Tezlanishni kiriting: ’); readln(a); write(‘vaqtni kiriting: ’); readln(t);
s:=v0*t+a*t*t/2;
writeln(‘S=’,s:5:2,’ birlik’);
readln;
end.
3. Yer sirtiga nisbatan α burchak ostida vo boshlang‘ich tezlik bilan otilgan jismning uchish masofasini aniqlash dasturini tuzing (yo’llanma: L=2 cossin/g, g=9,81).
Program Masofani_hisoblash_2;
uses crt;
var L,v0,alfa: real;
const g=9.81;
begin
write(‘Boshlang`ich tezlikni kiritingni kiriting: ’); readln(v0);
write(‘Burchak kattaligini kiriting: ’); readln(alfa); L:=2*v0*v0*cos(alfa)*sin(alfa)/g;
writeln(‘L=’,L:5:2,’ birlik’);
readln;
end.
4. Tashqi chizilgan aylananing radiusi R bo‘lgan 4 tomonli muntazam ko‘pburchakning tomonini hisoblash dasturini tuzing (yo’llanma: kvadrat diagonali – aylana diametri).
Program kvadrat_ tomoni;
Uses crt;
Var a,r: real;
Begin clrscr;
Write(‘Radiusni kiriting: ‘); readln(r); a:=sqr(2)*r; writeln(‘a=’;a:5:2); readln;
End.
5. Tomoni butun musbat a songa teng kvadratning diagonali uzunligini hisoblash dasturini tuzing (yo’llanma: kvadratning diagonali to’g’ri burchakli uchburchakning gipotenuzasi). Dasturda matn rangi, matn foni rangi, ekran rangi va chiqarish joyini belgilash operatoridan foydalaning.
a) a=20; b) a=4; d) a=89; e) a=21; f) a=7; g) a=63.
Program kvadrat_ diagonali;
Uses crt;
Var a: integer; d: real;
Begin clrscr;
Write(‘Kvadrat tomonini kiriting: ‘); readln(a); d:=sqrt(2*a*a); writeln(‘d=’;d:5:2); readln;
End.
6. Berilgan a va b butun sonlarni qiymatini almashtiruvchi dastur tuzing, ya’ni a=7 va b=2 kiritilsa, a=2 va b=7 natija chiqsin (yo’llanma: o’rin almashtirish m = a, a = b, b = m).
Program almashtirish;
Uses crt;
Var a,b,m: integer;
Begin clrscr;
Write(‘a ni kiriting’); readln(a); Write(‘b ni kiriting’); readln(b);
m:= a; a:=b; b:=m;
writeln(‘a=’,a,’, b=’,b); readln;
end.
7. Mos ravishda R1, R2, R3, R4 qarshilikka ega bo‘lgan o‘tkazgichlar parallel ulanganda hosil bo‘ladigan R qarshilikni hisoblash dasturini tuzing (yo’llanma: 1/R=1/R1+1/R2+1/R3+1/R4).
Program qarshilikni_hisoblash;
Uses crt;
Var R,R1,R2,R3,R4: real;
Begin clrscr;
Writeln(‘R1 ni kiriting: ’); readln(R1);
Writeln(‘R21 ni kiriting: ’); readln(R2);
Writeln(‘R3 ni kiriting: ’); readln(R3);
Writeln(‘R4 ni kiriting: ’); readln(R4);
R:=R1*R2*R3*R4/(R2*R3*R4+R1*R3*R4+R1*R2*R4+R1*R2*R3);
Writeln(‘R=’,R:5:2,’ birlik.’); readln;
End.
IV. Uyga vazifa
2-mashq
Dostları ilə paylaş: |