This function enables clearing of the current notebook :-
cls := Module[{nb},
nb = EvaluationNotebook[];
SelectionMove[nb, All, Notebook];
NotebookDelete@nb]
Once it is evaluated, possibly in an initialisation file, just type cls
to run.
Edit
Further to zeros comment, this will display the results in a fresh window.
Clear["Global`*"]
a = Input["ingrese a , a distinto de cero"];
b = Input["ingrese b "];
c = Input["ingrese c "];
CreateDocument[
ExpressionCell[
Row[{"La funcion es : y = ", TraditionalForm[a*"x"^"2" + b*"x" + c]}],
"Print"],
NotebookFileName -> "C:\\Users\\yo\\Desktop\\nb\\prueba.nb"];
If you also want to close the initial notebook you can add NotebookClose[]
at the end.
Also, if you want to close all other notebooks except the final output notebook you can add the following at the beginning :-
NotebookClose /@ DeleteCases[Notebooks[], EvaluationNotebook[]];
Note, you are only clearing variables in the global context. To clear variables in the current context you can use Clear@Evaluate[$Context <> "*"]
.