Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program kvadraticka;
- var
- a,b,c,d,x1,x2:real;
- begin
- writeln('Řešení kvadratické rovnice ax^2 + bx + c = 0.');
- writeln('Zadej a, b a c.');
- readln(a,b,c);
- if a=0 then writeln('Tato rovnice není kvadratická.')
- else begin d:=(b*b - (4 * a * c));
- if d<0 then writeln('Rovnice nemá řešení.')
- else
- if d=0 then begin x1:=(-b/(2*a)); x2:=x1;
- writeln('Kořen je jediný, a to ',x2:7:2,'.'); end
- else begin d:=sqrt(d);
- x1:=(-b + d)/(2*a);
- x2:=(-b - d)/(2*a);
- writeln('První kořen je ', x1:7:2, ', druhý kořen je ', x2:7:2,'.');
- end;
- end;
- readln();
- end.
Advertisement
Add Comment
Please, Sign In to add comment