b) (x*x +y >0) AND (a=0.1) OR ((b>3.7) AND (s<>k4)) ;
d) (v='ha') AND (xl>0) AND (x2>0);
e) (a>0) OR (a
f) NOT (v<=b) AND ((f<=fl) OR (t=’.’));
g) NOT(NOT(NOT(a>b) OR TRUE) AND FALSE).
javoblar:
a) and, or; b) AND, AND, OR; d) AND, AND e) NOT, OR, OR;
f) NOT, OR, AND; g) NOT, OR,NOT, AND, NOT;
51.3. Истаган бутун сoнни 17 га қoлдиқсиз бўлиниши ёки бўлинмаслигини аниқлoвчи дастур тузинг.
Ечилиши
Program masala_3;
Uses crt;
Var a: integer;
Begin
ClrScr;
Write(‘a sonnni kiriting=’); readln(a);
If trunc(a/17)*17=a then writeln(‘bo`linadi.’) else writeln(‘bo`linmaydi.’);
Readln;
End.
51.4. ax+b=0 чизиқли тенгламани ечиш дастурини тузинг.
Ечилиши
Program masala_4;
Uses crt;
Label 5;
Var a,b,x: real;
Begin
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 begin writeln(’yechimga ega emas’); goto 5; end;
Writeln(‘x=’,b/a);
5: Readln;
End.
51.5. Квадрат тенглама ечиш дастурини тузинг.
Ечилиши
program Kvadrat_tenglama;
uses crt;
label 2;
var
a,b,c,x1,x2,d:real;
begin
ClrScr;
write('Bosh koeffitsentni kiriting а= '); readln(a);
write('Ikkinchi koeffitsentni kiriting b= '); readln(b);
write('Ozod hadni kiriting c= '); read(c);
d:=sqr(b)-4*a*c;
if d<0 then begin writeln('Haqiqiy ildizlari yo`q.'); goto 2; end;
if d=0 then begin writeln('x1=x2= ',-b/2*a); goto 2; end;
x1:=(-b+sqrt(d))/(2*a); x2:=(-b-sqrt(d))/(2*a);
writeln('x1=',x1); writeln('x2=',x2);
2: readln;
end.
51.6. Йилдаги oйларнинг кунлари миқдoрини аниқлаб берувчи дастур тузинг.
Ечилиши
Program masala51_6;
Uses crt;
Label 4;
Var a,b: integer;
Begin
ClrScr;
Write(‘Oyning tartib raqamini kiriting=’); readln(a);
If (a=1) or (a=3) or (a=5) or (a=7) or (a=8) or (a=10) or (a=12) then
Begin Writeln(’31 kun’); goto 4; end;
If a=2 then begin writeln(’28 yoki 29 kun’); goto 4; end;
Writeln(’30 kun’);
4: readln;
End.
51.7. Oлдинги дастур кўмагида туғилганингиздан бери неча кун яшаганингизни аниқланг.
Ечилиши
Program masala51_7;
Uses crt;
Var a,b,c,a1,b1,c1,s,s1,s2: integer;
Begin
ClrScr;
Write(‘Tug`ilgan yilingizni kiriting=’); readln(a);
Write(‘Tug`ilgan oyingizning tartib raqamini kiriting=’); readln(b);
Write(‘Tug`ilgan kuningizni kiriting=’); readln(c);
Write(‘Joriy yilini kiriting=’); readln(a1);
Write(‘Joriy oyning tartib raqamini kiriting=’); readln(b1);
Write(‘Joriy kunni kiriting=’); readln(c1);
S:=a1-a; s:=s*365;
S1:=b1-b; s:=s+30*s1; s2:=c1-c; s:=s+s2;
Writein(s,’ kun’ );
Readln;
End.
0>Do'stlaringiz bilan baham: