I am a bit inexperienced with LaTeX and I have a code called "My code" that I want to make look like "Example". I have been trying to do it, but I don't know how to make it exactly similar. Here is the code:
Code: Select all
Code, edit and compile here:
\begin{lstlisting}[language=Pascal, basicstyle=\ttfamily\small,frame=single,title=SCRIPT,framesep=9pt,stringstyle=\color{violet},showstringspaces=false,keywordstyle=\color{blue},backgroundcolor=\color{white!90},rulecolor=\color{gray!30},identifierstyle=\color{black!85}]format longdisp('Dada la sucesion a = 1/(1 + 1/sqrt(n))^n')n=input('Coloque un numero mayor que 0. n = ');if n <= 0disp('(ERROR)El numero debe ser entero mayor que 0.')elsedisp(['Estos son los ',num2str(n),' terminos de la sucesion'])enda=zeros(1,n);for m=1:na(m)= 1 ./ (1 + 1 ./ sqrt(m)) .^ m;disp(a(m));endif n>0disp(['La suma de los ',num2str(n),' terminos es ',num2str(sum(a))])end\end{lstlisting}