Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Program Roots;
- var a, b, c, d, x1, x2: real;
- begin
- WriteLn('Введите коэффициенты квадратного уравнения:');
- a:=0;
- while a=0 do begin Write('a='); ReadLn(a); end;
- Write('b='); ReadLn(b);
- Write('c='); ReadLn(c);
- if a=0
- then
- if b=0
- then
- if c=0
- then WriteLn('Любое x - решение')
- else WriteLn('Нет решений')
- else
- begin
- x1:=-c/b;
- WriteLn ('x= ', x1)
- end
- else
- begin
- d:=b*b-4*a*c;
- if d<0
- then WriteLn('Нет вещественных корней')
- else
- begin
- x1:=(-b+sqrt(d))/2/a;
- x2:=(-b-sqrt(d))/2/a;
- WriteLn('x1=', x1);
- WriteLn('x2=', x2)
- end
- end
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement