Просмотр содержимого документа
«Линейный алгоритм»
9-dekabr kompyuter sichqonchasining “tug’ilgan kuni” hisoblanadi. 1968-yilning aynan shu kuni Stenford tadqiqot instituti xodimi Duglas Engelbart sichqonchani San-Fransiskodagi hisoblash texnikasi bo’yicha anjumanda taqdim qilgan.
11.12.2017
Mavzu: Chiziqli dasturlar tuzish
Chiziqli dastur deb chiziqli algoritmning dastur shaklida yozilishiga aytiladi.
1. Radiusi R ga teng bo’lgan aylananing yuzini topish dasturini tuzing.
Program aylana_yuzi;
Var
r,S:Real;
Begin
Write(‘Radiusni kiriting:’);
ReadLn(r);
S:= pi*sqr(r); WriteLn(‘S=‘,S);
End
Boshlanish
R ni qiymati kiriting
S:=3,14*R*R
S ning qiymati chiqarilsin
Tamom
2. a va b sonlarning o’rta geometrigini topish dasturini tuzing
Program o`rta_geometrik;
Var
a,b,G:Integer;
Begin
Write(‘a ni kiriting:’);
ReadLn(a);
Write(‘b ni kiriting:’);
ReadLn(b);
G:= sqrt(a*b);
WriteLn(‘G=‘,G);
End.
Boshlanish
a va b ni qiymati kiriting
G:=
G ning qiymati chiqarilsin
Tamom
3. Tomonlari a va b bo’lgan to’g’ri to’rtburchakning yuzini topish dasturini tuzing.
Program yuza;
Var
a,b,S:Integer;
Begin
Write(‘a ni kiriting:’);
ReadLn(a);
Write(‘b ni kiriting:’);
ReadLn(b);
S:= a*b;
WriteLn(‘S=‘,S);
End.
Boshlanish
a va b ni qiymati kiriting
S:=a*b
S ning qiymati chiqarilsin
Tamom
4. Shtrixlangan sohani yuzini toping
Boshlanish
Program yuza;
Var
r,b,S:Integer;
Begin
Write(‘r ni kiriting:’);
ReadLn(r);
Write(‘b ni kiriting:’);
ReadLn(b);
S:= (2*r*b)-(pi*sqr(r))/2;
WriteLn(‘S=‘,S);
End.
r va b ni qiymati kiriting
S:=(2r*b)-((3,14*r*r)/2)
S ning qiymati chiqarilsin
Tamom
a va b sonlarning o’rta arifmetigini topish dasturini tuzing
a va b sonlarning o’rta arifmetrigini topish dasturini tuzing