begin writeln('Enter the value of k: '); readln(k);
writeln('Enter the value of b: '); readln(b);
if k = 0 then writeln('Error: k cannot be zero.') else begin x := -b / k; writeln('The solution to the equation ', k:0:2, 'x + ', b:0:2, ' = 0 is x = ', x:0:2); end; end.
program SolveEquation;
var
k, b, x: real;
begin
writeln('Enter the value of k: ');
readln(k);
writeln('Enter the value of b: ');
readln(b);
if k = 0 then
writeln('Error: k cannot be zero.')
else
begin
x := -b / k;
writeln('The solution to the equation ', k:0:2, 'x + ', b:0:2, ' = 0 is x = ', x:0:2);
end;
end.