Добавил:
bagiwow
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Программирование / Лабораторные / ЭВТ-1-Паскаль / LABA3
.PAS program GSA; { Џа®Ја ¬¬ аҐиҐЁп Ґа ўҐбвў a*x*x+b*x+c<0 }
uses crt,graph;
var a,b,c:integer; { Љ®нддЁжЁҐвл ў га ўҐЁЁ }
d:integer; { ¤ЁбЄаЁ¬Ё в }
x1,x2:real; { ђҐиҐЁп га ўҐЁп }
BEGIN
clrscr;
textcolor(red);
writeln('ђҐиҐҐ¬ Ґа ўҐбвў® вЁЇ : a*x*x+b*x+c<0');
textcolor(white);
writeln('‚ўҐ¤ЁвҐ Є®нддЁжЁҐвл a,b,c ');
readln(a,b,c);
d:=sqr(b)-4*a*c;
if (a=0) and (b=0) then begin
if c<0 then writeln(' ђҐиҐЁҐ¬ ¤ ®Ј® Ґа ўҐбвў пў«повбп ўбҐ ¤Ґ©б⢨⥫млҐ зЁб« ')
else writeln(' ђҐиҐЁ© Ґв ')
end
else
if a=0 then begin
x1:=-c/b;
if b<0 then writeln(' ђҐиҐЁҐ¬ ¤ ®Ј® Ґа ўҐбвў пў«повбп ўбҐ ¤Ґ©б⢨⥫млҐ зЁб« Ў®«миҐ ',x1:4:2)
else writeln(' ђҐиҐЁҐ¬ ¤ ®Ј® Ґа ўҐбвў пў«повбп ўбҐ ¤Ґ©б⢨⥫млҐ зЁб« ¬ҐмиҐ ',x1:4:2)
end
else
begin
if (d<0) and (a<0) then writeln(' ђҐиҐЁҐ¬ ¤ ®Ј® Ґа ўҐбвў пў«повбп ўбҐ ¤Ґ©б⢨⥫млҐ зЁб« ');
if (d<0) and (a>0) then writeln(' ђҐиҐЁ© Ґв ');
if (d=0) then begin
x1:=-b/(2*a);
if a>0 then writeln(' ђҐиҐЁ© Ґв ')
else writeln(' ђҐиҐЁҐ¬ ¤ ®Ј® Ґа ўҐбвў пў«повбп ўбҐ ¤Ґ©б⢨⥫млҐ зЁб« Єа®¬Ґ ',x1:4:2)
end;
if d>0 then begin
x1:=(-b+sqrt(d))/(2*a);
x2:=(-b-sqrt(d))/(2*a);
if a<>0 then write(' ђҐиҐЁҐ¬ ¤ ®Ј® Ґа ўҐбвў пў«повбп ўбҐ ¤Ґ©б⢨⥫млҐ зЁб« Ў®«миҐ ',x2:4:2,' ® ¬ҐмиҐ ',x1:4:2);
end;
end;
readln
END.
uses crt,graph;
var a,b,c:integer; { Љ®нддЁжЁҐвл ў га ўҐЁЁ }
d:integer; { ¤ЁбЄаЁ¬Ё в }
x1,x2:real; { ђҐиҐЁп га ўҐЁп }
BEGIN
clrscr;
textcolor(red);
writeln('ђҐиҐҐ¬ Ґа ўҐбвў® вЁЇ : a*x*x+b*x+c<0');
textcolor(white);
writeln('‚ўҐ¤ЁвҐ Є®нддЁжЁҐвл a,b,c ');
readln(a,b,c);
d:=sqr(b)-4*a*c;
if (a=0) and (b=0) then begin
if c<0 then writeln(' ђҐиҐЁҐ¬ ¤ ®Ј® Ґа ўҐбвў пў«повбп ўбҐ ¤Ґ©б⢨⥫млҐ зЁб« ')
else writeln(' ђҐиҐЁ© Ґв ')
end
else
if a=0 then begin
x1:=-c/b;
if b<0 then writeln(' ђҐиҐЁҐ¬ ¤ ®Ј® Ґа ўҐбвў пў«повбп ўбҐ ¤Ґ©б⢨⥫млҐ зЁб« Ў®«миҐ ',x1:4:2)
else writeln(' ђҐиҐЁҐ¬ ¤ ®Ј® Ґа ўҐбвў пў«повбп ўбҐ ¤Ґ©б⢨⥫млҐ зЁб« ¬ҐмиҐ ',x1:4:2)
end
else
begin
if (d<0) and (a<0) then writeln(' ђҐиҐЁҐ¬ ¤ ®Ј® Ґа ўҐбвў пў«повбп ўбҐ ¤Ґ©б⢨⥫млҐ зЁб« ');
if (d<0) and (a>0) then writeln(' ђҐиҐЁ© Ґв ');
if (d=0) then begin
x1:=-b/(2*a);
if a>0 then writeln(' ђҐиҐЁ© Ґв ')
else writeln(' ђҐиҐЁҐ¬ ¤ ®Ј® Ґа ўҐбвў пў«повбп ўбҐ ¤Ґ©б⢨⥫млҐ зЁб« Єа®¬Ґ ',x1:4:2)
end;
if d>0 then begin
x1:=(-b+sqrt(d))/(2*a);
x2:=(-b-sqrt(d))/(2*a);
if a<>0 then write(' ђҐиҐЁҐ¬ ¤ ®Ј® Ґа ўҐбвў пў«повбп ўбҐ ¤Ґ©б⢨⥫млҐ зЁб« Ў®«миҐ ',x2:4:2,' ® ¬ҐмиҐ ',x1:4:2);
end;
end;
readln
END.
Соседние файлы в папке ЭВТ-1-Паскаль