So, I'm trying to write a SIMPLE program in pascal to solve a quadratic equation. I am not into computer programming at all and i have to do this for a chem lab. If anyone can help me out it would be appreciated. Here's the program: it keeps telling me there's a problem in line 15! but i can't figure out why it won't compile:
program assignment2;
var a,b,c,x,z:real;
begin
x:=0.0;
z:=0.0;
writeln('Enter values for a, b, and c');
writeln('a??');readln(a);
writeln('b??');readln(b);
writeln('c??');readln(c);
z:=sqrt((b*b-4*a*c)/(2a)); (***This is the line where the problem supposedly is (I think)***)
x:=(-b+z);
writeln('One of the solutions of the quadratic equation with those coefficients is ',x);
writeln('Continue?');readln;
x:=(-b-z);
writeln('The other solution is',x);
writeln('Press any key to exit the program...');readln;
end.
program assignment2;
var a,b,c,x,z:real;
begin
x:=0.0;
z:=0.0;
writeln('Enter values for a, b, and c');
writeln('a??');readln(a);
writeln('b??');readln(b);
writeln('c??');readln(c);
z:=sqrt((b*b-4*a*c)/(2a)); (***This is the line where the problem supposedly is (I think)***)
x:=(-b+z);
writeln('One of the solutions of the quadratic equation with those coefficients is ',x);
writeln('Continue?');readln;
x:=(-b-z);
writeln('The other solution is',x);
writeln('Press any key to exit the program...');readln;
end.