Edit: See below an improved version.
Note the [fragile]
in \begin{frame}
. Necessary with \FPifpos
.
\documentclass{beamer}
\usepackage{fp}
\begin{document}
\begin{frame}[fragile]{Quadratic equation}
\FPset\ca{1}
\FPset\cb{-5}
\FPset\cc{6}
\FPqsolve\xone\xtwo\ca\cb\cc
\FPeval\xone{clip(round(xone:4))}
\FPeval\xtwo{clip(round(xtwo:4))}
\FPeval\babs{clip(round(abs(cb):4))}
\FPeval\cabs{clip(round(abs(cc):4))}
Quadratic equation : $\ca x^2$ \FPifpos\cb $+$ \else $-$ \fi $\babs x$ \FPifpos\cc $+$ \else $-$ \fi $\cabs=0$ %\\[1cm]
Result: $x = \xone \quad \text{and} \quad x = \xtwo$
\end{frame}
\end{document}

Improved version
This version handle better special situations (when some coefficients of the equation became -1, 1 or 0).
As fp
's \FPqsolve
doesn't handle equations without solutions (it emit an error), my code don't display correctly equations where the "x^2" AND the "x" term are null (it display, when the compiler don't stop at errors, something like: Quadratic equation: +6 = 0). This code is intended to be used only when the equation has real(s) solution(s).
\documentclass{beamer}
\usepackage{fp}
\begin{document}
\begin{frame}[fragile]{Quadratic equation}
\FPset\ca{1}
\FPset\cb{-5}
\FPset\cc{6}
\FPqsolve\xone\xtwo\ca\cb\cc
\FPeval\xone{clip(round(xone:4))}
\FPeval\xtwo{clip(round(xtwo:4))}
\FPeval\aabs{clip(round(abs(ca):4))}
\FPeval\babs{clip(round(abs(cb):4))}
\FPeval\cabs{clip(round(abs(cc):4))}
\newcommand{\signa}{\FPifneg\ca -\else\fi}
\newcommand{\positiveSignBWithA}{\FPifzero\ca \else +\fi} % if \ca is 0, no positive sign before the "x" term if cb is positive
\newcommand{\signb}{\FPifneg\cb -\else \positiveSignBWithA\fi}
\newcommand{\signc}{\FPifneg\cc -\else +\fi}
\newcommand{\coeffa}{\FPifeq\aabs1 \else\aabs\fi}
\newcommand{\coeffb}{\FPifeq\babs1 \else\babs\fi}
\newcommand{\polya}{\FPifzero\ca \else\signa\coeffa x^2\fi}
\newcommand{\polyb}{\FPifzero\cb \else\signb\coeffb x\fi}
\newcommand{\polyc}{\FPifzero\cc \else\signc\cabs\fi}
Quadratic equation : $\polya \polyb \polyc =0$ \\[1cm]
Result: $x = \xone \quad \text{and} \quad x = \xtwo$
\end{frame}
\end{document}
