-03
1
:
1
-03
09.03.04
..
2015
1
.
2 + + = 0
, , . , : VAR ,,: REAL;
,, READLN (,,);
, :
, , .. = 0 , 2 - 4<0 , . : . .
, 6 :
= = = 0 - , - ;
= = , ¹ 0 - ;
= 0; ¹ 0 - = - /;
¹ 0; 2 - 4 = 0 - 1 = 2 = - /2;
¹ 0; 2 - 4 > 0 - :
¹ 0; B2 - 4<0 - - .
IF GOTO
Program lab1_1;
var a, b, c, d, e, d1, x1, x2: real;
begin
writeln (' a, b, c'); readln (a, b, c);
if ((a=0) and (b=0) and (c=0)) then writeln ('x- ');
if ((a=0) and (b=0) and (c<>0)) then writeln (' ');
if ((a=0) and (b<>0)) then writeln (' x = ', -c/b);
d:= b*b-4*a*c;
e:= 2*a;
d1:= sqrt(abs(d));
if ((a<>0) and (d=0)) then writeln (' x1 = x2 = ', -b/e);
if ((a<>0) and (d>0)) then
begin
writeln (' ');
writeln ('x1 = ', (-b+d1)/e);
writeln ('x2 = ', (-b-d1)/e);
end;
if ((a<>0) and (d<0)) then
begin
writeln (' -');
writeln ('x1 = ', -b/e, ' -i* ', d1/e);
writeln ('x2 = ', -b/e, ' +i* ', d1/e);
end;
end.
x | |||
0,8 | |||
x = -1.25 | |||
x1 = x2 = -1 | |||
x1 = -1, x2 = -1.5 | |||
2,3 | 7,65 | 4,2 | x1 = -0.693700064364498, x2 = -2.63238689215724 |
2,38 | 1,42 | 14,26 | - x1 = -0.298319327731092 i * 2.42952715921381 x2 = -0.298319327731092 + i * 2.42952715921381 |
|
|
9
A = 15,1 B = 40,03 C = 201 :
-
x1 = -1.32549668874172 -i* 3.3991641334717
x2 = -1.32549668874172 +i* 3.3991641334717
CASE GOTO
Program lab1_2;
var a, b, c, d, e, d1, x1, x2: real;
begin
writeln (' a, b, c'); readln (a, b, c);
case ((a=0) and (b=0) and (c=0)) of
true: writeln ('x - ');
false:
case ((a=0) and (b=0) and (c<>0)) of
true: writeln (' ');
false:
case ((a=0) and (b<>0)) of
true: writeln (' x = ', -c/b);
false:
begin
d:= b*b-4*a*c;
e:= 2*a; d1:= sqrt(abs(d));
case ((a<>0) and (d=0)) of
true: writeln (' x1 = x2 = ', -b/e);
false:
case ((a<>0) and (d>0)) of
true:
begin
writeln (' ');
writeln ('x1 = ', (-b+d1)/e);
writeln ('x2 = ', (-b-d1)/e);
end;
false:
case ((a<>0) and (d<0)) of
true:
begin
writeln (' ');
writeln ('x1 = ', -b/e, ' - i * ', d1/e);
writeln ('x2 = ', -b/e, ' + i * ', d1/e);
end;
end;
end;
end;
end;
end;
end;
end;
end.
x | |||
0,8 | |||
x = -1.25 | |||
x1 = x2 = -1 | |||
x1 = -1, x2 = -1.5 | |||
2,3 | 7,65 | 4,2 | x1 = -0.693700064364498, x2 = -2.63238689215724 |
2,38 | 1,42 | 14,26 | - x1 = -0.298319327731092 i * 2.42952715921381 x2 = -0.298319327731092 + i * 2.42952715921381 |
9
A = 15,1 B = 40,03 C = 201 :
-
x1 = -1.32549668874172 -i* 3.3991641334717
x2 = -1.32549668874172 +i* 3.3991641334717