tin học
bài 1
Program bai1;
Var Fx,x:real;
Begin
write('nhap so thuc x:'); readln(x);
if (0<x) and (x<=1) then Fx:= 4*sqr(x)-5*x+1
else Fx:= Abs(x-2)/(3*sqr(x)+3);
[ if (x<=0) or (x>1) then Fx:= Abs(x-2)/(3*sqr(x)+3);]
write('Fx=',Fx:10:3);
readln;
end.
bài 2
program bai2;
var a,b,c: integer;
D,x1,x2: real;
begin
write('nhap he so a,b,c (a khac 0):'); Readln(a,b,c);
D:=sqr(b)-4*a*c;
if D<0 then write('phuong trinh vo nghiem')
else
begin
x1:=(-b-sqrt(D))/(2*a);
x2:=(-b+sqrt(D))/(2*a);
end;
writeln('nghiem 1 cua phuong trinh la:',x1:10:3);
write('nghiem 2 cua phuong trinh la:',x2:10:3);
readln;
end.
bài 6
program bai6;
var a,b,x,S: Real;
Begin
Writeln('giai bat phuong trinh: ax+b>0');
Write('nhap so a,b:'); Readln(a,b);
if (a=0) and (b<0) then writeln(' phuong trinh vo nghiem');
if (a=0) and (b>0) then writeln('phuong trinh vo so nghiem');
if a>0 then begin S:=-b/a;
writeln('x > ',S:10:3);end;
if a<0 then begin S:=-b/a;
writeln('x < ',S:10:3);end;
readln;
end.
bài 7
program bai7;
Var a,b,S: real;
begin
writeln('giai phuong trinh ax+b=0');
write('nhap so a,b:'); Readln(a,b);
if (a=0) and (b=0) then writeln(' phuong trinh vo so nghiem');
if (a=0) and (b<>0) then writeln('phuong trinh vo nghiem');
if a<>0 then begin S:=-b/a; writeln('x=',S:7:3);end;
readln;
end.
Bạn đang đọc truyện trên: AzTruyen.Top