
01.10.2008, 00:16
|
|
Познающий
Регистрация: 02.03.2007
Сообщений: 43
С нами:
10101447
Репутация:
42
|
|
Syntaxys
ИМХО темой ошибся. Лучше, наверное было бы сюда
Вот решение:
Код:
program descriminant;
var a,b,c,D:real;
begin
writeln('Solving a*x^2+b*x+c=0');
write('Input a=');
readln(a);
write('Input b=');
readln(b);
write('Input c=');
readln(c);
D:=b*b-4*a*c;
if D<0 then writeln('D<0 where are no solutions')
else if D=0 then writeln('Solution is x1=',-b/2/a)
else
begin
writeln('First solution is x1=',(-b+sqrt(D))/2/a);
writeln('Second solution is x2=',(-b-sqrt(D))/2/a);
end;
end.
|
|
|