O`tilgan mavzu yuzasidan qo`shimcha topshiriqlar.
1. Berilgan qiymat asosida shart qiymatini aniqlang.
a) a:=10; b:=a*3; shart: «a
b) a:=10; b:=a*3; shart: «a<=b/3»; javob: Ha
d) a:=10; b:=a; shart: «a+b=2*b»; javob: Ha
e) a:=10; b:=a+3; shart: «a+3>=b~3»; javob: Ha
2. Tarmoqlanish natijasida hosil bo'ladigan qiymatlarni aniqlang.
aa: = 7; bb: = 6.6; if aa=round(bb) then mm: = 'Ha' else mm:='Yovq';
javob: Ha
Ikkita a va b sonlar berilgan. Agar b son a dan kichik bo'lsa, u holda b ni nol bilan almashtiruvchi, aks holda b ni o'zgarishsiz qoldiruvchi dastur tuzing.
Program masala_3;
Var a: iteger;
b: Real;
Begin ClrScr
Write(‘a ningqiymatini kiriting: '); ReadLn(a);
Write(‘b ning qiymatini kiriting: '); ReadLn(b);
If a>b Then b=0 else WriteLn(‘b= ‘, b); readln;
End.
Uchta a, b va c sonlar berilgan. Bu sonlardan faqat musbatlarining kvadrat ildizini hisoblab chiqaruvchi dastur tuzing.
Program masala_4;
Label tamom;
Var a, b,c: integer;
Begin ClrScr
Write(‘a- sonni kiriting: '); ReadLn(a);
Write(‘b-sonni kiriting: '); ReadLn(b);
Write(‘c-sonni kiriting: '); ReadLn(c);
If(a>=0) and (b>=0) and (c>=0) Then WriteLn('Bu sonlar orasida manfiylari yo’q’); goto tamom; end;
If a>0 then WriteLn( a,’ning ildizi=’,sqrt(a));
If b>0 then WriteLn( b,’ning ildizi=’, sqrt(b))
If a<0 then WriteLn( c,’ning ildizi =’, sqrt(c))
tamom: End.
5. ax + b = o tenglamaning ildizini a, b ning quyidagi qiymatlarida hisoblash dasturini tuzing.
a) a= -1, b=l; b) a=0, b=4; d) a=l, b=0; e) a=l, b= -5.
Program masala_5;
Label5;
Var a, b,x: Real;
Begin ClrScr
Write(‘a ni kiriting: '); ReadLn(a);
Write(‘b ni kiriting: '); ReadLn(b);
If(a=0) and (b=0) Then begin
WriteLn('x istalgan son ’); goto 5; end;
If a=0 then WriteLn( ’yechimga ega emas’); goto 5; end;
WriteLn( ’x=’, b/a)
5: End.
Uyga vazifa: Darslikdagi 7-mashq.
Sana :_________
Sinf : _________
0>
|