Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  a
Language: PASCAL
Code:
Program Quartic(output);
var A,B,C,det:real;
X1,X2:real;
begin
repeat
writeln ('Please input the value of A,B,C of quartic equations Ax^2+Bx+C=0');
Readln(A,B,C);
until ((trunc(A)=A) and (trunc(B)=B) and (trunc(C)=C));
det:=B*B-4*A*C;
If det=0 then
begin
X1:=-B/2/A;
writeln ('The solution is',X1:2:1);
end
Else if det>0 then
begin
X1:=-B+sqrt(det)/2/A;
X2:=-B-sqrt(det)/2/A;
writeln ('The solution are',X1:2:1,'and',X2:2:1);
end
Else 
writeln ('No solution');
end.

          
Comments: