2. Ixtiyoriy a,b,c lar uchun berilgan kvadrat tenglamani echish.
Program Kvadrat_tenglama;
Var a,b,c:Integer;
D,x1,x2:real;
begin
write('a ni kirit='); readln(a);
write('b ni kirit='); readln(b);
write('c ni kirit='); readln(c);
D:=(b*b-4*a*c);
if D<0 then writeln('Yechi yo`q') else
begin
x1:=(-b+sqr(D))/2;
x2:=(-b-sqr(D))/2;
if D>0 then writeln('x1=',x1:2:0);
writeln('x2=',x2:2:0);
end;
readln;
end.
3. Kamida ikki xonali bo’lgan N natural soni berilgan bo’lsin. Unda kichik bo’lgan birinch tub sonni tiping.
Program Lab_4_2;
Var n,I,m: integer; y: srring[3];
Begin
Raed (‘N ni kiriting’);
Writeln(n); y:=’yo’q’;
While(n>2) and (‘y=yo’q’) do
Begin
If in mod i=0 then y:=’ha’
i:=i+1;
end
n:=n-1;
end
if y:=’yo’q’ then writeln (‘Bu son=’,n) eles writeln (‘Bu son=’,2) ;
end.
0>
Do'stlaringiz bilan baham: |